modelscope / modelscope

ModelScope: bring the notion of Model-as-a-Service to life.
https://www.modelscope.cn/
Apache License 2.0
6.76k stars 698 forks source link

need offline support #924

Closed xalteropsx closed 1 month ago

xalteropsx commented 1 month ago

File "Z:\software\python11\Lib\site-packages\modelscope\pipelines\builder.py", line 118, in pipeline model = normalize_model_input( ^^^^^^^^^^^^^^^^^^^^^^ File "Z:\software\python11\Lib\site-packages\modelscope\pipelines\builder.py", line 29, in normalize_model_input if isinstance(model, str) and is_official_hub_path(model, model_revision): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "Z:\software\python11\Lib\site-packages\modelscope\pipelines\util.py", line 41, in is_official_hub_path return is_official_hub_impl(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "Z:\software\python11\Lib\site-packages\modelscope\pipelines\util.py", line 38, in is_official_hub_impl raise ValueError(f'invalid model repo path {e}') ValueError: invalid model repo path HTTPSConnectionPool(host='www.modelscope.cn', port=443): Max retries exceeded with url: /api/v1/models/iic/cv_unet_skin_retouching_torch (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F8511D1D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

cannot able to work offline

yingdachen commented 1 month ago

have you check this:

https://www.modelscope.cn/docs/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98#q5%EF%BC%9Amodelscope-%E6%A8%A1%E5%9E%8B%E7%9A%84%E4%BD%BF%E7%94%A8%E4%BE%9D%E8%B5%96%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E8%BF%9E%E6%8E%A5%E5%90%97%EF%BC%9Fbr%3E

xalteropsx commented 1 month ago

@yingdachen bro it has an problem like if u pass pipeliine( model="iic/offlinemodel") it fail by above error cause it cant understand the path but while loading the internet it work

so the short fix is to pass full path like pipeline(model="d:\panda\sad\iic\offlinemodel")
but the issue bring back if some model wont exist and we pass the full path will be issue

yingdachen commented 1 month ago

@yingdachen bro it has an problem like if u pass pipeliine( model="iic/offlinemodel") it fail by above error cause it cant understand the path but while loading the internet it work

so the short fix is to pass full path like pipeline(model="d:\panda\sad\iic\offlinemodel") but the issue bring back if some model wont exist and we pass the full path will be issue

things like "iic/offlinemodel" is the modelscope model id, which instruct the code to query remote hub for latest version of the model (it will use local cache if there is no newer version on the hub). therefore, use you should make sure a local copy exists and use full local model path if you want to skip any remote round trip.

xalteropsx commented 1 month ago

but i mention above if i use full local model path // assume what if i want to download unknown model just by passing name also want to get offline existing model if network disable so just a way to bypass latest version check and get full path of model since u already able to track model directory even passing icc/offlinemodel why need to pass full path thats an issue

cannot u just add a dictonary and offline support so it will check first offline model before checking latest version from hub if their is a no network connection

xalteropsx commented 1 month ago

nvm bro seems like u dont understand the problem @yingdachen actually u should disable remote hub for latest version of model if their is no network on user or if he working offline / a way skip version check if no network and check if directory exist or not rather passing whole directory that what i saying but i closing this seems like no one have interest i will manually create dictonary for it

yingdachen commented 1 month ago

you can always specify "local_files_only=True" :)

xalteropsx commented 1 month ago

thanks that will work as well