I'm currently trying to run the Colab notebook demo, but I get the following error when running the 2nd cell:
The code:
import os
import cv2
from moviepy.editor import ImageSequenceClip
from modelscope.models.cv.face_reconstruction.utils import write_obj
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
face_reconstruction = pipeline(Tasks.face_reconstruction, model='damo/cv_resnet50_face-reconstruction', model_revision='v2.0.0-HRN')
The error:
2023-06-15 17:24:06,122 - modelscope - INFO - PyTorch version 2.0.1+cu118 Found.
2023-06-15 17:24:06,137 - modelscope - INFO - TensorFlow version 2.12.0 Found.
2023-06-15 17:24:06,140 - modelscope - INFO - Loading ast index from /root/.cache/modelscope/ast_indexer
2023-06-15 17:24:06,256 - modelscope - INFO - Loading done! Current index file version is 1.6.1, with md5 5703f34095fb68603c387701a17ebb07 and a total number of 849 components indexed
2023-06-15 17:24:10,793 - modelscope - INFO - Use user-specified model revision: v2.0.0-HRN
2023-06-15 17:24:18,423 - modelscope - INFO - initiate model from /root/.cache/modelscope/hub/damo/cv_resnet50_face-reconstruction
2023-06-15 17:24:18,425 - modelscope - INFO - initiate model from location /root/.cache/modelscope/hub/damo/cv_resnet50_face-reconstruction.
2023-06-15 17:24:18,429 - modelscope - INFO - initialize model from /root/.cache/modelscope/hub/damo/cv_resnet50_face-reconstruction
initialize network with normal
initialize network with normal
2023-06-15 17:24:27,319 - modelscope - WARNING - No preprocessor field found in cfg.
2023-06-15 17:24:27,322 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2023-06-15 17:24:27,324 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/root/.cache/modelscope/hub/damo/cv_resnet50_face-reconstruction'}. trying to build by task and model information.
2023-06-15 17:24:27,326 - modelscope - WARNING - No preprocessor key ('face_reconstruction', 'face-reconstruction') found in PREPROCESSOR_MAP, skip building preprocessor.
loading the model from /root/.cache/modelscope/hub/damo/cv_resnet50_face-reconstruction/pytorch_model.pt
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/lib/python3.10/dist-packages/modelscope/utils/registry.py:212 in build_from_cfg │
│ │
│ 209 │ │ if hasattr(obj_cls, '_instantiate'): │
│ 210 │ │ │ return obj_cls._instantiate(**args) │
│ 211 │ │ else: │
│ ❱ 212 │ │ │ return obj_cls(**args) │
│ 213 │ except Exception as e: │
│ 214 │ │ # Normal TypeError does not print class name. │
│ 215 │ │ raise type(e)(f'{obj_cls.__name__}: {e}') │
│ │
│ /usr/local/lib/python3.10/dist-packages/modelscope/pipelines/cv/face_reconstruction_pipeline.py: │
│ 106 in __init__ │
│ │
│ 103 │ │ │ os.path.join(model_root, 'face_alignment', 'depth-6c4283c0e0.zip'), │
│ 104 │ │ │ save_ckpt_dir) │
│ 105 │ │ self.lm_sess = face_alignment.FaceAlignment( │
│ ❱ 106 │ │ │ face_alignment.LandmarksType._3D, flip_input=False) │
│ 107 │ │ │
│ 108 │ │ config = tf.ConfigProto(allow_soft_placement=True) │
│ 109 │ │ config.gpu_options.per_process_gpu_memory_fraction = 0.2 │
│ │
│ /usr/lib/python3.10/enum.py:437 in __getattr__ │
│ │
│ 434 │ │ try: │
│ 435 │ │ │ return cls._member_map_[name] │
│ 436 │ │ except KeyError: │
│ ❱ 437 │ │ │ raise AttributeError(name) from None │
│ 438 │ │
│ 439 │ def __getitem__(cls, name): │
│ 440 │ │ return cls._member_map_[name] │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: _3D
During handling of the above exception, another exception occurred:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 9>:9 │
│ │
│ /usr/local/lib/python3.10/dist-packages/modelscope/pipelines/builder.py:140 in pipeline │
│ │
│ 137 │ if preprocessor is not None: │
│ 138 │ │ cfg.preprocessor = preprocessor │
│ 139 │ │
│ ❱ 140 │ return build_pipeline(cfg, task_name=task) │
│ 141 │
│ 142 │
│ 143 def add_default_pipeline_info(task: str, │
│ │
│ /usr/local/lib/python3.10/dist-packages/modelscope/pipelines/builder.py:56 in build_pipeline │
│ │
│ 53 │ │ │ :obj:`Tasks` for more details. │
│ 54 │ │ default_args (dict, optional): Default initialization arguments. │
│ 55 │ """ │
│ ❱ 56 │ return build_from_cfg( │
│ 57 │ │ cfg, PIPELINES, group_key=task_name, default_args=default_args) │
│ 58 │
│ 59 │
│ │
│ /usr/local/lib/python3.10/dist-packages/modelscope/utils/registry.py:215 in build_from_cfg │
│ │
│ 212 │ │ │ return obj_cls(**args) │
│ 213 │ except Exception as e: │
│ 214 │ │ # Normal TypeError does not print class name. │
│ ❱ 215 │ │ raise type(e)(f'{obj_cls.__name__}: {e}') │
│ 216 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: FaceReconstructionPipeline: _3D
I successfully installed all libraries and made sure to restart the runtime. I'm also using a GPU on runtime and CUDA is seems to be loading without issues. The same error also occurs when running the notebook locally, and it also seems to occur on the updated notebook mentioned on issue #22
Please let me know if there's a fix for the issue.
Hi, thank you for sharing your amazing work!
I'm currently trying to run the Colab notebook demo, but I get the following error when running the 2nd cell:
The code:
The error:
I successfully installed all libraries and made sure to restart the runtime. I'm also using a GPU on runtime and CUDA is seems to be loading without issues. The same error also occurs when running the notebook locally, and it also seems to occur on the updated notebook mentioned on issue #22
Please let me know if there's a fix for the issue.
Thanks!