zmwv823 / ComfyUI-AnyText

Unofficial implementation of AnyText. Generate or edit image with text (Mainly English & Chinese) in ComfyUI
https://127.0.0.1:9999
61 stars 3 forks source link

No module named 'scripts.bert_tokenizer' #4

Open CaringZ opened 1 month ago

CaringZ commented 1 month ago

求助,大佬为啥明明文件夹里有bert_tokenizer.py,但是却一直说检测不到 !!! Exception during processing!!! No module named 'scripts.bert_tokenizer'

Traceback (most recent call last): File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnyText\AnyText\nodes.py", line 177, in anytext_process pipe = pipeline('my-anytext-task', model=path, font_path=loader_out[0], ckpt_path=loader_out[1], clip_path=loader_out[2], use_fp16=fp16, translator_path=loader_out[3], use_translator=use_translator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\pipelines\builder.py", line 134, in pipeline register_modelhub_repo(model, cfg.get('allow_remote', False)) File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\utils\plugins.py", line 455, in register_modelhub_repo import_module_from_model_dir(model_dir) File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\utils\plugins.py", line 400, in import_module_from_model_dir importlib.import_module(submodule) File "importlibinit.py", line 126, in import_module File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1140, in _find_and_load_unlocked ModuleNotFoundError: No module named 'scripts.bert_tokenizer'

zmwv823 commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

CaringZ commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

是的同样的报错,我查看了一下发现这里的路径不对:

'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py

sys.path: ['E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\cg-image-picker', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\python311.zip', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\aliyun_python_sdk_core-2.15.1-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\jmespath-0.10.0-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32\lib', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\Pythonwin', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager\glob', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\custom_mmpkg', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py

Error importing bert_tokenizer: cannot import name 'bert_tokenizer' from 'scripts' (unknown location)

zmwv823 commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

是的同样的报错,我查看了一下发现这里的路径不对:

'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py

sys.path: ['E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\cg-image-picker', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\python311.zip', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\aliyun_python_sdk_core-2.15.1-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\jmespath-0.10.0-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32\lib', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\Pythonwin', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager\glob', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\custom_mmpkg', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py

Error importing bert_tokenizer: cannot import name 'bert_tokenizer' from 'scripts' (unknown location)

Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText,这里面套壳了custom_nodes。 如果路径没问题,把下面内容(官方启动脚本)复制到一个bat文件,放到E:\SD\SDcomfyui\Blender_ComfyUI\下运行试试:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pause
CaringZ commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

是的同样的报错,我查看了一下发现这里的路径不对: 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py sys.path: ['E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\cg-image-picker', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\python311.zip', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\aliyun_python_sdk_core-2.15.1-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\jmespath-0.10.0-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32\lib', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\Pythonwin', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager\glob', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\custom_mmpkg', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py Error importing bert_tokenizer: cannot import name 'bert_tokenizer' from 'scripts' (unknown location)

Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText,这里面套壳了custom_nodes。 如果路径没问题,把下面内容(官方启动脚本)复制到一个bat文件,放到E:\SD\SDcomfyui\Blender_ComfyUI\下运行试试:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pause

一样的报错,甚至我照着这个路径创建了一个一样的路径把bert_tokenizer.py放到里面都不行

zmwv823 commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

是的同样的报错,我查看了一下发现这里的路径不对: 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py sys.path: ['E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\cg-image-picker', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\python311.zip', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\aliyun_python_sdk_core-2.15.1-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\jmespath-0.10.0-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32\lib', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\Pythonwin', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager\glob', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\custom_mmpkg', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py Error importing bert_tokenizer: cannot import name 'bert_tokenizer' from 'scripts' (unknown location)

Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText,这里面套壳了custom_nodes。 如果路径没问题,把下面内容(官方启动脚本)复制到一个bat文件,放到E:\SD\SDcomfyui\Blender_ComfyUI\下运行试试:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pause

一样的报错,甚至我照着这个路径创建了一个一样的路径把bert_tokenizer.py放到里面都不行

要不试试comfyui官方整合包,如果也报错那就是代码哪里有问题没发现。 如果没报错,那就可能是你当前使用的comfyui可能使用了某种环境变量。这个变量导致脚本获取自身路径出错。 以我当前的代码知识,实在找不到bug在哪个位置。

CaringZ commented 1 month ago

最新的也报错吗,我试着改了下导入包方法看能否解决,21分钟前更新的。

是的同样的报错,我查看了一下发现这里的路径不对: 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py sys.path: ['E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\cg-image-picker', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\python311.zip', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\aliyun_python_sdk_core-2.15.1-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\jmespath-0.10.0-py3.11.egg', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\win32\lib', 'E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\Pythonwin', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager\glob', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\custom_mmpkg', 'E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts'] bert_tokenizer.py not found at: E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText\AnyText\scripts\bert_tokenizer.py Error importing bert_tokenizer: cannot import name 'bert_tokenizer' from 'scripts' (unknown location)

Blender_ComfyUI\ComfyUI\custom_nodes\custom_nodes\ComfyUI-AnyText,这里面套壳了custom_nodes。 如果路径没问题,把下面内容(官方启动脚本)复制到一个bat文件,放到E:\SD\SDcomfyui\Blender_ComfyUI\下运行试试:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pause

一样的报错,甚至我照着这个路径创建了一个一样的路径把bert_tokenizer.py放到里面都不行

要不试试comfyui官方整合包,如果也报错那就是代码哪里有问题没发现。 如果没报错,那就可能是你当前使用的comfyui可能使用了某种环境变量。这个变量导致脚本获取自身路径出错。 以我当前的代码知识,实在找不到bug在哪个位置。

找到原因了,ComfyUI-MotionCtrl-SVD这个插件也有一个scripts,然后就跟你的冲突了,查找包没查找到你的这个

CaringZ commented 1 month ago

然后我把这个ComfyUI-MotionCtrl-SVD插件删除后又报错

!!! Exception during processing!!! cannot import name 'conv_nd' from 'ldm.modules.diffusionmodules.util' (E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy\ldm\modules\diffusionmodules\util.py) Traceback (most recent call last): File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-AnyText\AnyText\nodes.py", line 178, in anytext_process pipe = pipeline('my-anytext-task', model=path, font_path=loader_out[0], ckpt_path=loader_out[1], clip_path=loader_out[2], use_fp16=fp16, translator_path=loader_out[3], cfg_path=loader_out[4], use_translator=use_translator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\pipelines\builder.py", line 134, in pipeline register_modelhub_repo(model, cfg.get('allow_remote', False)) File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\utils\plugins.py", line 455, in register_modelhub_repo import_module_from_model_dir(model_dir) File "E:\SD\SDcomfyui\Blender_ComfyUI\python_embeded\Lib\site-packages\modelscope\utils\plugins.py", line 400, in import_module_from_model_dir importlib.import_module(submodule) File "importlib__init__.py", line 126, in import_module File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\Administrator.cache\modelscope\modelscope_modules\scripts\cldm\cldm.py", line 8, in from ldm.modules.diffusionmodules.util import ( ImportError: cannot import name 'conv_nd' from 'ldm.modules.diffusionmodules.util' (E:\SD\SDcomfyui\Blender_ComfyUI\ComfyUI\comfy\ldm\modules\diffusionmodules\util.py)

CaringZ commented 1 month ago

很不幸的告诉你,没修复成功,还是同样的报错。

zmwv823 commented 1 month ago

很不幸的告诉你,没修复成功,还是同样的报错。

并不是修bug,而是修复插件冲突,重命名了bert_tokenizer.py。 这个报错的话,大概率是环境不一样导致的。 正常情况下应该直接从C:\Users\username\.cache\modelscope\modelscope_modules 下导包,但是你们这种情况下是从comfyui导包(个人猜测是环境变量的问题)。 遗憾的是,comfyui里面的并不是完整包,所以导入会失败。 刚更新了v2,不知道能不能正常使用,我这一直都是测试正常的。