modelscope / facechain

FaceChain is a deep-learning toolchain for generating your Digital-Twin.
Apache License 2.0
9.02k stars 852 forks source link

Error with automatic1111 #459

Closed daxxxxxx76 closed 5 months ago

daxxxxxx76 commented 11 months ago

First, I am just an user, I do not know about coding, phyton etc, so I just post what is happen, i have automatic1111, with cuda development package and visual studio c++, when i try to use facechain always appear this error my system AMD 3900x 64GB ram RTX 2080TI 11GB Vram

显存足够 Setting base model to SD1.5 --------uuid: qw ----------work_dir: H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\person1 2023-12-05 13:30:03,612 - modelscope - INFO - Use user-specified model revision: v1.0.0 A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' 2023-12-05 13:30:10,223 - modelscope - INFO - PyTorch version 2.0.1+cu118 Found. 2023-12-05 13:30:10,226 - modelscope - INFO - Loading ast index from C:\Users\Davide.cache\modelscope\ast_indexer 2023-12-05 13:30:10,348 - modelscope - INFO - Loading done! Current index file version is 1.9.5, with md5 afb29aaa180877d987bdd2eda7064fea and a total number of 945 components indexed 2023-12-05 13:30:12,914 - modelscope - INFO - Use user-specified model revision: v4.0 2023-12-05 13:30:16,906 - modelscope - INFO - Use user-specified model revision: v1.0.1 2023-12-05 13:30:17,620 - modelscope - WARNING - ('PIPELINES', 'skin-retouching-torch', 'skin-retouching-torch') not found in ast index file 2023-12-05 13:30:17,620 - modelscope - INFO - initiate model from C:\Users\Davide.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch 2023-12-05 13:30:17,621 - modelscope - INFO - initiate model from location C:\Users\Davide.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch. 2023-12-05 13:30:17,633 - modelscope - WARNING - No preprocessor field found in cfg. 2023-12-05 13:30:17,633 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. 2023-12-05 13:30:17,633 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\Users\Davide\.cache\modelscope\hub\damo\cv_unet_skin_retouching_torch'}. trying to build by task and model information. 2023-12-05 13:30:17,633 - modelscope - WARNING - Find task: skin-retouching-torch, model type: None. Insufficient information to build preprocessor, skip building preprocessor 2023-12-05 13:30:23,526 - modelscope - WARNING - Model revision not specified, use revision: v2.0.2 2023-12-05 13:30:25,534 - modelscope - INFO - initiate model from C:\Users\Davide.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface 2023-12-05 13:30:25,534 - modelscope - INFO - initiate model from location C:\Users\Davide.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface. 2023-12-05 13:30:25,548 - modelscope - WARNING - No preprocessor field found in cfg. 2023-12-05 13:30:25,548 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file. 2023-12-05 13:30:25,548 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'C:\Users\Davide\.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface'}. trying to build by task and model information. 2023-12-05 13:30:25,548 - modelscope - WARNING - Find task: face-detection, model type: None. Insufficient information to build preprocessor, skip building preprocessor 2023-12-05 13:30:25,553 - modelscope - INFO - loading model from C:\Users\Davide.cache\modelscope\hub\damo\cv_resnet50_face-detection_retinaface\pytorch_model.pt 2023-12-05 13:30:25,965 - modelscope - INFO - load model done Process Process-1: Traceback (most recent call last): File "H:\stable-diffusion-webui\venv\lib\site-packages\modelscope\utils\registry.py", line 212, in build_from_cfg return obj_cls(**args) File "C:\Users\Davide.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\Davide.cache\modelscope\modelscope_modules\cv_unet_skin_retouching_torch\ms_wrapper.py", line 93, in load_onnx_model sess = onnxruntime.InferenceSession(onnx_path) File "H:\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 432, in init raise e File "H:\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "H:\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 451, in _create_inference_session raise ValueError( ValueError: This ORT build has ['AzureExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For example, onnxruntime.InferenceSession(..., providers=['AzureExecutionProvider', 'CPUExecutionProvider'], ...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Davide\AppData\Local\Programs\Python\Python311\lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Users\Davide\AppData\Local\Programs\Python\Python311\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "H:\stable-diffusion-webui\extensions\facechain\facechain\inference.py", line 25, in _data_process_fn_process Blipv2()(input_img_dir) File "H:\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 "H:\stable-diffusion-webui\venv\lib\site-packages\modelscope\pipelines\builder.py", line 162, in pipeline return build_pipeline(cfg, task_name=task) File "H:\stable-diffusion-webui\venv\lib\site-packages\modelscope\pipelines\builder.py", line 65, in build_pipeline return build_from_cfg( File "H:\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}') ValueError: SkinRetouchingTorchPipeline: This ORT build has ['AzureExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For example, onnxruntime.InferenceSession(..., providers=['AzureExecutionProvider', 'CPUExecutionProvider'], ...) instance_data_dir H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\person1 Traceback (most recent call last): File "H:\stable-diffusion-webui\extensions\facechain\facechain\train_text_to_image_lora.py", line 30, in import cv2 ModuleNotFoundError: No module named 'cv2' Error executing the command: Command '['python', 'H:\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=H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\person1', '--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=H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\person1', '--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 "H:\stable-diffusion-webui\extensions\facechain\app.py", line 147, in train_lora_fn subprocess.run(command, check=True) File "C:\Users\Davide\AppData\Local\Programs\Python\Python311\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['python', 'H:\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=H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\person1', '--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=H:\stable-diffusion-webui\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\person1', '--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 "H:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "H:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "H:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "H:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "H:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "H:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, args) File "H:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "H:\stable-diffusion-webui\extensions\facechain\app.py", line 801, in run train_lora_fn(base_model_path=base_model_path, File "H:\stable-diffusion-webui\extensions\facechain\app.py", line 150, in train_lora_fn raise gr.Error("训练失败 (Training failed)") gradio.exceptions.Error: '训练失败 (Training failed)'

Someone has idea what can be the issue? Thank you to all

RayYe586 commented 10 months ago

解决了吗?同样的问题

HtheChemist commented 10 months ago

The subprocess spawned by app.py use the system python and not the venv python.

in app.py, add import sys at the begining and change 'python' on line 97 and 122 to sys.executable, this will launch the righ python version with the venv module.

hcl67 commented 10 months ago

this fixed my "ModuleNotFoundError" issue

The subprocess spawned by app.py use the system python and not the venv python.

in app.py, add import sys at the begining and change 'python' on line 97 and 122 to sys.executable, this will launch the righ python version with the venv module.

VurtualUS commented 10 months ago

Ran into similar problems. Please help.

jeongsoo56 commented 9 months ago

The subprocess spawned by app.py use the system python and not the venv python.

in app.py, add import sys at the begining and change 'python' on line 97 and 122 to sys.executable, this will launch the righ python version with the venv module.

Don't make foolish mistake like me.

it is sys.executable

command = [ sys.executable, f'{project_dir}/facechain/train_text_to_image_lora_sdxl.py' if base_model_path is SDXL_BASE_MODEL_ID else f'{project_dir}/facechain/train_text_to_image_lora.py',

not 'sys.executable'

command = [ 'sys.executable', f'{project_dir}/facechain/train_text_to_image_lora_sdxl.py' if base_model_path is SDXL_BASE_MODEL_ID else f'{project_dir}/facechain/train_text_to_image_lora.py',

sunbaigui commented 5 months ago

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