2022-08-12 15:13:31,245 - modelscope - INFO - File README.md already in cache, skip downloading!
2022-08-12 15:13:31,247 - modelscope - INFO - File configuration.json already in cache, skip downloading!
2022-08-12 15:13:31,252 - modelscope - INFO - File examples.jpg already in cache, skip downloading!
2022-08-12 15:13:31,254 - modelscope - INFO - File skin_retouching.png already in cache, skip downloading!
2022-08-12 15:13:31,256 - modelscope - INFO - File joint_20210926.pth already in cache, skip downloading!
2022-08-12 15:13:31,258 - modelscope - INFO - File pytorch_model.pt already in cache, skip downloading!
2022-08-12 15:13:31,260 - modelscope - INFO - File retinaface_resnet50_2020-07-20_old_torch.pth already in cache, skip downloading!
2022-08-12 15:13:31,263 - modelscope - INFO - File tf_graph.pb already in cache, skip downloading!
2022-08-12 15:13:31,279 - modelscope - INFO - initiate model from /mnt/workspace/.cache/modelscope/damo/cv_unet_skin-retouching
2022-08-12 15:13:31,279 - modelscope - INFO - initiate model from location /mnt/workspace/.cache/modelscope/damo/cv_unet_skin-retouching.
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
207 else:
--> 208 return obj_cls(**args)
209 except Exception as e:
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/cv/skin_retouching_pipeline.py in __init__(self, model, device)
54
---> 55 self.generator = UNet(3, 3).to(device)
56 self.generator.load_state_dict(
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in to(self, *args, **kwargs)
906
--> 907 return self._apply(convert)
908
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
600 with torch.no_grad():
--> 601 param_applied = fn(param)
602 should_use_set_data = compute_should_use_set_data(param, param_applied)
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in convert(t)
904 non_blocking, memory_format=convert_to_format)
--> 905 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
906
/opt/conda/lib/python3.7/site-packages/torch/cuda/__init__.py in _lazy_init()
209 if not hasattr(torch._C, '_cuda_getDeviceCount'):
--> 210 raise AssertionError("Torch not compiled with CUDA enabled")
211 if _cudart is None:
AssertionError: Torch not compiled with CUDA enabled
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
/tmp/ipykernel_1040/365630354.py in <module>
4 from modelscope.utils.constant import Tasks
5
----> 6 skin_retouching = pipeline(Tasks.skin_retouching,model='damo/cv_unet_skin-retouching')
7 result = skin_retouching('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_cartoon.png')
8 cv2.imwrite('result2.png', result['output_img'])
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/builder.py in pipeline(task, model, preprocessor, config_file, pipeline_name, framework, device, model_revision, **kwargs)
248 cfg.preprocessor = preprocessor
249
--> 250 return build_pipeline(cfg, task_name=task)
251
252
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/builder.py in build_pipeline(cfg, task_name, default_args)
161 """
162 return build_from_cfg(
--> 163 cfg, PIPELINES, group_key=task_name, default_args=default_args)
164
165
/opt/conda/lib/python3.7/site-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
209 except Exception as e:
210 # Normal TypeError does not print class name.
--> 211 raise type(e)(f'{obj_cls.__name__}: {e}')
AssertionError: SkinRetouchingPipeline: Torch not compiled with CUDA enabled
import cv2
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
skin_retouching = pipeline(Tasks.skin_retouching,model='damo/cv_unet_skin-retouching')
result = skin_retouching('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_cartoon.png')
cv2.imwrite('result2.png', result[OutputKeys.OUTPUT_IMG])
print('finished!')
2022-08-12 15:18:40,342 - modelscope - INFO - File README.md already in cache, skip downloading!
2022-08-12 15:18:40,345 - modelscope - INFO - File configuration.json already in cache, skip downloading!
2022-08-12 15:18:40,349 - modelscope - INFO - File examples.jpg already in cache, skip downloading!
2022-08-12 15:18:40,351 - modelscope - INFO - File skin_retouching.png already in cache, skip downloading!
2022-08-12 15:18:40,353 - modelscope - INFO - File joint_20210926.pth already in cache, skip downloading!
2022-08-12 15:18:40,356 - modelscope - INFO - File pytorch_model.pt already in cache, skip downloading!
2022-08-12 15:18:40,358 - modelscope - INFO - File retinaface_resnet50_2020-07-20_old_torch.pth already in cache, skip downloading!
2022-08-12 15:18:40,360 - modelscope - INFO - File tf_graph.pb already in cache, skip downloading!
2022-08-12 15:18:40,376 - modelscope - INFO - initiate model from /mnt/workspace/.cache/modelscope/damo/cv_unet_skin-retouching
2022-08-12 15:18:40,376 - modelscope - INFO - initiate model from location /mnt/workspace/.cache/modelscope/damo/cv_unet_skin-retouching.
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
207 else:
--> 208 return obj_cls(**args)
209 except Exception as e:
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/cv/skin_retouching_pipeline.py in __init__(self, model, device)
54
---> 55 self.generator = UNet(3, 3).to(device)
56 self.generator.load_state_dict(
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in to(self, *args, **kwargs)
906
--> 907 return self._apply(convert)
908
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
577 for module in self.children():
--> 578 module._apply(fn)
579
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _apply(self, fn)
600 with torch.no_grad():
--> 601 param_applied = fn(param)
602 should_use_set_data = compute_should_use_set_data(param, param_applied)
/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in convert(t)
904 non_blocking, memory_format=convert_to_format)
--> 905 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
906
/opt/conda/lib/python3.7/site-packages/torch/cuda/__init__.py in _lazy_init()
209 if not hasattr(torch._C, '_cuda_getDeviceCount'):
--> 210 raise AssertionError("Torch not compiled with CUDA enabled")
211 if _cudart is None:
AssertionError: Torch not compiled with CUDA enabled
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
/tmp/ipykernel_1040/2692908915.py in <module>
4 from modelscope.utils.constant import Tasks
5
----> 6 skin_retouching = pipeline(Tasks.skin_retouching,model='damo/cv_unet_skin-retouching')
7 result = skin_retouching('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_cartoon.png')
8 cv2.imwrite('result2.png', result[OutputKeys.OUTPUT_IMG])
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/builder.py in pipeline(task, model, preprocessor, config_file, pipeline_name, framework, device, model_revision, **kwargs)
248 cfg.preprocessor = preprocessor
249
--> 250 return build_pipeline(cfg, task_name=task)
251
252
/opt/conda/lib/python3.7/site-packages/modelscope/pipelines/builder.py in build_pipeline(cfg, task_name, default_args)
161 """
162 return build_from_cfg(
--> 163 cfg, PIPELINES, group_key=task_name, default_args=default_args)
164
165
/opt/conda/lib/python3.7/site-packages/modelscope/utils/registry.py in build_from_cfg(cfg, registry, group_key, default_args)
209 except Exception as e:
210 # Normal TypeError does not print class name.
--> 211 raise type(e)(f'{obj_cls.__name__}: {e}')
AssertionError: SkinRetouchingPipeline: Torch not compiled with CUDA enabled
评论