facechain icon indicating copy to clipboard operation
facechain copied to clipboard

model scope's notebook not work

Open hotpot-killer opened this issue 1 year ago • 6 comments

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'

hotpot-killer avatar Aug 20 '24 14:08 hotpot-killer

so i can not runing this project ,please help me

hotpot-killer avatar Aug 20 '24 14:08 hotpot-killer

same problem

linxiaohui avatar Sep 04 '24 03:09 linxiaohui

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:

linxiaohui avatar Sep 09 '24 01:09 linxiaohui

Due to the update of the modelscope notebook, the original image has been removed from the options. We will adjust the code to adapt to the new image soon.

You-Cun avatar Sep 24 '24 09:09 You-Cun

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'

image 这个可以

zhangpanpan1 avatar Sep 25 '24 07:09 zhangpanpan1

Modelscope now supports the previous image: ubuntu20.04-cuda11.7.1-py38-torch2.0.1-tf1.15.5-1.8.1. If there still remains problem, please refer to issue https://github.com/modelscope/facechain/issues/561.

You-Cun avatar Sep 25 '24 07:09 You-Cun