video depth estimation support cpu mode

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11442862
This commit is contained in:
qianmu.ywh
2023-01-16 09:54:45 +00:00
committed by wenmeng.zwm
parent 78d9952ee3
commit df0c3bebc5
2 changed files with 4 additions and 3 deletions

View File

@@ -52,7 +52,8 @@ class DROEstimation(TorchModel):
if torch.cuda.is_available():
model_wrapper = self.model_wrapper.to('cuda')
else:
raise RuntimeError('cuda is not available')
model_wrapper = self.model_wrapper
print('cuda is not available, use cpu')
# Set to eval mode
model_wrapper.eval()

View File

@@ -15,8 +15,8 @@ class VideoDepthEstimationTest(unittest.TestCase, DemoCompatibilityCheck):
self.task = 'video-depth-estimation'
self.model_id = 'damo/cv_dro-resnet18_video-depth-estimation_indoor'
@unittest.skipUnless(test_level() >= 3, 'skip test in current test level')
def test_image_depth_estimation(self):
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
def test_video_depth_estimation(self):
input_location = 'data/test/videos/video_depth_estimation.mp4'
estimator = pipeline(Tasks.video_depth_estimation, model=self.model_id)
result = estimator(input_location)