facechain icon indicating copy to clipboard operation
facechain copied to clipboard

ModuleNotFoundError: No module named 'diffusers' / AttributeError: module 'onnxruntime' has no attribute 'InferenceSession'

Open CRCODE22 opened this issue 2 years ago • 1 comments

Traceback (most recent call last): File "K:\stable-diffusion-webui\extensions\facechain\facechain\train_text_to_image_lora.py", line 32, in import diffusers ModuleNotFoundError: No module named 'diffusers' Error executing the command: Command '['python', 'K:\stable-diffusion-webui\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\Testmodel', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\Testmodel', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1. Traceback (most recent call last): File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 147, in train_lora_fn subprocess.run(command, check=True) File "C:\Users\CRCODE22\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['python', 'K:\stable-diffusion-webui\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\Testmodel', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\Testmodel', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(*args, **kwargs) File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 804, in run train_lora_fn(base_model_path=base_model_path, File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 150, in train_lora_fn raise gr.Error("训练失败 (Training failed)") gradio.exceptions.Error: '训练失败 (Training failed)' 显存足够 ** Setting base model to SD1.5 ** --------uuid: qw ----------work_dir: K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\Testmodel 2024-01-14 01:30:53,052 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:30:57,651 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:30:59,862 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:01,941 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:04,231 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:06,082 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:08,130 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:09,852 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:11,782 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:13,738 - modelscope - INFO - Use user-specified model revision: v1.0.0 2024-01-14 01:31:15,770 - modelscope - INFO - Use user-specified model revision: v1.0.0 K:\stable-diffusion-webui\venv\lib\site-packages\torchvision\models\detection\anchor_utils.py:63: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem . (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.) device: torch.device = torch.device("cpu"), bin K:\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.dll A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' 2024-01-14 01:31:37,847 - modelscope - INFO - PyTorch version 2.0.1+cu118 Found. 2024-01-14 01:31:37,854 - modelscope - INFO - Loading ast index from C:\Users\CRCODE22.cache\modelscope\ast_indexer 2024-01-14 01:31:38,241 - modelscope - INFO - Loading done! Current index file version is 1.11.0, with md5 2030ae2fe1fad6aa9fee9c7e5400f606 and a total number of 953 components indexed 2024-01-14 01:31:41,762 - modelscope - INFO - Use user-specified model revision: v4.0 2024-01-14 01:31:45,369 - modelscope - INFO - Use user-specified model revision: v1.0.1 2024-01-14 01:31:46,027 - modelscope - WARNING - ('PIPELINES', 'skin-retouching-torch', 'skin-retouching-torch') not found in ast index file 2024-01-14 01:31:46,028 - modelscope - INFO - initiate model from C:\Users\CRCODE22.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch 2024-01-14 01:31:46,029 - modelscope - INFO - initiate model from location C:\Users\CRCODE22.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch. 2024-01-14 01:31:46,056 - modelscope - WARNING - No preprocessor field found in cfg. 2024-01-14 01:31:46,057 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. 2024-01-14 01:31:46,057 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\Users\CRCODE22\.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch'}. trying to build by task and model information. 2024-01-14 01:31:46,059 - modelscope - WARNING - Find task: skin-retouching-torch, model type: None. Insufficient information to build preprocessor, skip building preprocessor 2024-01-14 01:31:50,484 - modelscope - WARNING - Model revision not specified, use revision: v2.0.2 2024-01-14 01:31:52,666 - modelscope - INFO - initiate model from C:\Users\CRCODE22.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface 2024-01-14 01:31:52,667 - modelscope - INFO - initiate model from location C:\Users\CRCODE22.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface. 2024-01-14 01:31:52,680 - modelscope - WARNING - No preprocessor field found in cfg. 2024-01-14 01:31:52,680 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. 2024-01-14 01:31:52,682 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\Users\CRCODE22\.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface'}. trying to build by task and model information. 2024-01-14 01:31:52,683 - modelscope - WARNING - Find task: face-detection, model type: None. Insufficient information to build preprocessor, skip building preprocessor 2024-01-14 01:31:52,687 - modelscope - INFO - loading model from C:\Users\CRCODE22.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface\pytorch_model.pt 2024-01-14 01:31:53,217 - modelscope - INFO - load model done Process Process-2: Traceback (most recent call last): File "K:\stable-diffusion-webui\venv\lib\site-packages\modelscope\utils\registry.py", line 212, in build_from_cfg return obj_cls(**args) File "C:\Users\CRCODE22.cache\modelscope\modelscope_modules\cv_unet_skin_retouching_torch\ms_wrapper.py", line 76, in init self.sess, self.input_node_name, self.out_node_name = self.load_onnx_model( File "C:\Users\CRCODE22.cache\modelscope\modelscope_modules\cv_unet_skin_retouching_torch\ms_wrapper.py", line 93, in load_onnx_model sess = onnxruntime.InferenceSession(onnx_path) AttributeError: module 'onnxruntime' has no attribute 'InferenceSession'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\CRCODE22\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Users\CRCODE22\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "K:\stable-diffusion-webui\extensions\facechain\facechain\inference.py", line 25, in _data_process_fn_process Blipv2()(input_img_dir) File "K:\stable-diffusion-webui\extensions\facechain\facechain\data_process\preprocessing.py", line 205, in init self.skin_retouching = pipeline('skin-retouching-torch', model='damo/cv_unet_skin_retouching_torch', model_revision='v1.0.1') File "K:\stable-diffusion-webui\venv\lib\site-packages\modelscope\pipelines\builder.py", line 170, in pipeline return build_pipeline(cfg, task_name=task) File "K:\stable-diffusion-webui\venv\lib\site-packages\modelscope\pipelines\builder.py", line 65, in build_pipeline return build_from_cfg( File "K:\stable-diffusion-webui\venv\lib\site-packages\modelscope\utils\registry.py", line 215, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') AttributeError: SkinRetouchingTorchPipeline: module 'onnxruntime' has no attribute 'InferenceSession' instance_data_dir K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\Testmodel Traceback (most recent call last): File "K:\stable-diffusion-webui\extensions\facechain\facechain\train_text_to_image_lora.py", line 32, in import diffusers ModuleNotFoundError: No module named 'diffusers' Error executing the command: Command '['python', 'K:\stable-diffusion-webui\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\Testmodel', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\Testmodel', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1. Traceback (most recent call last): File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 147, in train_lora_fn subprocess.run(command, check=True) File "C:\Users\CRCODE22\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['python', 'K:\stable-diffusion-webui\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\Testmodel', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=K:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\Testmodel', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "K:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "K:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(*args, **kwargs) File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 804, in run train_lora_fn(base_model_path=base_model_path, File "K:\stable-diffusion-webui\extensions\facechain\app.py", line 150, in train_lora_fn raise gr.Error("训练失败 (Training failed)") gradio.exceptions.Error: '训练失败 (Training failed)'

CRCODE22 avatar Jan 14 '24 00:01 CRCODE22

My system has 128 GB RAM and Nvidia RTX 3060 12 GB and Windows 11.

CRCODE22 avatar Jan 14 '24 00:01 CRCODE22

please try out the newest train-free, 10s inference version facechain-fact.

sunbaigui avatar Jun 04 '24 09:06 sunbaigui