modelscope / facechain

FaceChain is a deep-learning toolchain for generating your Digital-Twin.
Apache License 2.0
8.88k stars 833 forks source link

model scope's notebook not work #597

Open zhenhua22 opened 3 weeks ago

zhenhua22 commented 3 weeks ago

when i run !python3 app.py in modelscope

it report me : 2024-08-20 22:25:36,056 - modelscope - WARNING - No preprocessor field found in cfg. 2024-08-20 22:25:36,056 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. 2024-08-20 22:25:36,056 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/mnt/workspace/.cache/modelscope/hub/damo/cv_resnet101_image-multiple-human-parsing'}. trying to build by task and model information. 2024-08-20 22:25:36,056 - modelscope - WARNING - No preprocessor key ('m2fp', 'image-segmentation') found in PREPROCESSOR_MAP, skip building preprocessor. 2024-08-20 22:25:36,731 - modelscope - INFO - Use user-specified model revision: v1.0.3 Downloading: 0.00B [00:00, ?B/s] Traceback (most recent call last): File "/mnt/workspace/facechain/app.py", line 574, in gen_portrait = GenPortrait() File "/mnt/workspace/facechain/facechain/inference_fact.py", line 297, in init self.image_face_fusion = pipeline('face_fusion_torch', File "/usr/local/lib/python3.10/site-packages/modelscope/pipelines/builder.py", line 118, in pipeline model = normalize_model_input( File "/usr/local/lib/python3.10/site-packages/modelscope/pipelines/builder.py", line 36, in normalize_model_input model = snapshot_download( File "/usr/local/lib/python3.10/site-packages/modelscope/hub/snapshot_download.py", line 84, in snapshot_download return _snapshot_download( File "/usr/local/lib/python3.10/site-packages/modelscope/hub/snapshot_download.py", line 241, in _snapshot_download _download_file_lists( File "/usr/local/lib/python3.10/site-packages/modelscope/hub/snapshot_download.py", line 416, in _download_file_lists download_file(url, repo_file, temporary_cache_dir, cache, headers, File "/usr/local/lib/python3.10/site-packages/modelscope/hub/file_download.py", line 606, in download_file file_integrity_validation(temp_file, file_meta[FILE_HASH]) File "/usr/local/lib/python3.10/site-packages/modelscope/hub/utils/utils.py", line 88, in file_integrity_validation file_sha256 = compute_hash(file_path) File "/usr/local/lib/python3.10/site-packages/modelscope/hub/utils/utils.py", line 68, in compute_hash with open(file_path, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '/mnt/workspace/.cache/modelscope/hub/.___temp/damo/cv_unet_face_fusion_torch/image_face_fusion/network/init__.py'

zhenhua22 commented 3 weeks ago

so i can not runing this project ,please help me

linxiaohui commented 1 week ago

same problem

linxiaohui commented 4 days ago

It seems that the http_get_model_file function in file_download.py does not handle file of size 0 correctly.

the code

            if partial_length >= file_size:
                break
            # closed range[], from 0.
            get_headers['Range'] = 'bytes=%s-%s' % (partial_length,
                                                    file_size - 1)
            with open(temp_file_path, 'ab+') as f:
                r = requests.get(
                    url,

does not create file if the size is 0 (cv_unet_face_fusion_torch/image_face_fusion/network/__init__.py is the case)

a temporary workround is change the condition if partial_length >= file_size: to if file_size!=0 and partial_length >= file_size: