开发者社区 > ModelScope模型即服务 > 计算机视觉 > 正文

在ModelScope中, 在文档里没查到解决方法呢。请问还有其他解决思路不?

Traceback (most recent call last):
File "test_qt.py", line 15, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "special.py", line 38, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "mix.py", line 20, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "modelscope\pipelines__init.py", line 4, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "modelscope\pipelines\base.py", line 16, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "modelscope\msdatasets\
init.py", line 2, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "modelscope\msdatasets\ms_dataset.py", line 9, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "datasets\
init.py", line 52, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "datasets\inspect.py", line 30, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "datasets\load.py", line 58, in
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "datasets\packaged_modules\
init__.py", line 32, in
File "inspect.py", line 1139, in getsource
File "inspect.py", line 1121, in getsourcelines
File "inspect.py", line 958, in findsource
OSError: could not get source code
大佬这个问题 在文档里没查到解决方法呢。请问还有其他解决思路不

展开
收起
崔问问 2023-12-03 23:20:23 68 0
3 条回答
写回答
取消 提交回答
  • 面对过去,不要迷离;面对未来,不必彷徨;活在今天,你只要把自己完全展示给别人看。

    这个问题可能是由于PyInstaller在打包时没有正确地包含某些依赖库导致的。你可以尝试以下方法来解决这个问题:

    1. 确保你的代码中导入了所有需要的库,包括modelscopedatasets等。

    2. 在你的代码中添加以下内容,以便在运行时动态地将缺失的库添加到系统路径中:

    import sys
    import os
    
    sys.path.append(os.path.abspath("path/to/your/missing/library"))
    

    "path/to/your/missing/library"替换为实际缺失库的路径。

    1. 使用--hidden-import选项来告诉PyInstaller包含特定的库。例如:
    pyinstaller --hidden-import=modelscope --hidden-import=datasets your_script.py
    
    2023-12-04 14:44:46
    赞同 展开评论 打赏
  • 这个问题可能是由于在打包过程中,某些依赖库的源代码无法获取导致的。你可以尝试以下方法来解决这个问题:

    1. 确保你的代码中没有使用到第三方库的动态导入功能,如importlib.import_module()等。如果有,请尝试将这些功能替换为静态导入。

    2. 检查你的代码中是否有对外部文件或资源的引用,如图片、音频等。如果有,请确保这些文件或资源与你的代码文件在同一个目录下,或者提供正确的路径。

    3. 尝试使用其他打包工具,如cx_FreezePyOxidizer等,看看是否能解决问题。

    2023-12-04 14:08:34
    赞同 展开评论 打赏
  • 您看一下会不会是datasets包的原因。modelscope这边目前还没有pyinstaller相关的文档。。此回答整理自钉钉群:魔搭ModelScope开发者联盟群 ①

    2023-12-04 08:06:22
    赞同 展开评论 打赏

包含图像分类、图像生成、人体人脸识别、动作识别、目标分割、视频生成、卡通画、视觉评价、三维视觉等多个领域

热门讨论

热门文章

相关电子书

更多
视觉AI能力的开放现状及ModelScope实战 立即下载
ModelScope助力语音AI模型创新与应用 立即下载
低代码开发师(初级)实战教程 立即下载