csxmli2016 / w-plus-adapter

[CVPR 2024] When StyleGAN Meets Stable Diffusion: a W+ Adapter for Personalized Image Generation
Other
119 stars 8 forks source link

The training debugging parameters are incorrect due to the shell script file. #5

Open gaoyixuan111 opened 6 months ago

gaoyixuan111 commented 6 months ago

Thank you for your encouragement all along. When I execute the .sh file directly in my virtual environment, the code trains normally. However, when I debug it in VS Code using the JSON file below, I encounter the following error traceback. I would appreciate any advice you can provide. The following is the JSON file I modified based on the .sh file for debugging purposes.: { "name": "train_face.py", "type": "debugpy", "cwd":"/root/autodl-tmp/w-plus-adapter-main", "request": "launch", // "program": "${file}", "program": "train_face.py", "args": [ "/root/miniconda3/envs/py38w/bin/python", "/root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher", "56159", "--", "accelerate", "launch", "--config_file=","8_gpu.json", "--main_process_port=","25655", "train_face.py", "--pretrained_model_name_or_path=","./stable-diffusion-v1-5", "--data_json_file=","None", "--data_root_path=","None", "--mixed_precision=","fp16", "--resolution=","256", "--train_batch_size=","1", "--dataloader_num_workers=","1", "--learning_rate=","1e-04 ", "--dataloader_num_workers=","1", "--weight_decay","0.1", "--output_dir=","./experimentsstage1${date_now}", "--save_steps=","50", ], "console": "integratedTerminal" }

=================================================

The error traceback message I received is: (py38w) root@autodl-container-f7da119752-d5d74c8f:~/autodl-tmp/w-plus-adapter-main# cd /root/autodl-tmp/w-plus-adapter-main ; /usr/bin/env /root/miniconda3/envs/py38w/bin/python /root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56819 -- train_face.py /root/miniconda3/envs/py38w/bin/python /root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56159 -- accelerate launch --config_file= 8_gpu.json --main_process_port= 25655 train_face.py --pretrained_model_name_or_path= ./stable-diffusion-v1-5 --data_json_file= None --data_root_path= None --mixed_precision= fp16 --resolution= 256 --train_batch_size= 1 --dataloader_num_workers= 1 --learning_rate= 1e-04\ --dataloader_num_workers= 1 --weight_decay 0.1 --output_dir= ./experimentsstage1\${date_now} --save_steps= 50 usage: train_face.py [-h] --pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH --data_json_file DATA_JSON_FILE --data_root_path DATA_ROOT_PATH [--output_dir OUTPUT_DIR] [--logging_dir LOGGING_DIR] [--validation_steps VALIDATION_STEPS] [--resolution RESOLUTION] [--learning_rate LEARNING_RATE] [--weight_decay WEIGHT_DECAY] [--num_train_epochs NUM_TRAIN_EPOCHS] [--train_batch_size TRAIN_BATCH_SIZE] [--dataloader_num_workers DATALOADER_NUM_WORKERS] [--save_steps SAVE_STEPS] [--mixed_precision {no,fp16,bf16}] [--report_to REPORT_TO] [--local_rank LOCAL_RANK] train_face.py: error: the following arguments are required: --pretrained_model_name_or_path, --data_json_file, --data_root_path (py38w) root@autodl-container-f7da119752-d5d74c8f:~/autodl-tmp/w-plus-adapter-main#

=================================================== "--data_json_file" and "--data_root_path" are both set to "None" in both the sh file and the train.py file, and why wasn't the "--pretrained_model_name_or_path" parameter passed in? This is confusing to me. Thank you for any help you can provide. Alternatively, could you help me write a correct JSON file for debugging during training?

csxmli2016 commented 6 months ago

Thank you for your encouragement all along. When I execute the .sh file directly in my virtual environment, the code trains normally. However, when I debug it in VS Code using the JSON file below, I encounter the following error traceback. I would appreciate any advice you can provide. The following is the JSON file I modified based on the .sh file for debugging purposes.: { "name": "train_face.py", "type": "debugpy", "cwd":"/root/autodl-tmp/w-plus-adapter-main", "request": "launch", // "program": "${file}", "program": "train_face.py", "args": [ "/root/miniconda3/envs/py38w/bin/python", "/root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher", "56159", "--", "accelerate", "launch", "--config_file=","8_gpu.json", "--main_process_port=","25655", "train_face.py", "--pretrained_model_name_or_path=","./stable-diffusion-v1-5", "--data_json_file=","None", "--data_root_path=","None", "--mixed_precision=","fp16", "--resolution=","256", "--train_batch_size=","1", "--dataloader_num_workers=","1", "--learning_rate=","1e-04 ", "--dataloader_num_workers=","1", "--weight_decay","0.1", "--output_dir=","./experimentsstage1${date_now}", "--save_steps=","50", ], "console": "integratedTerminal" }

=================================================

The error traceback message I received is: (py38w) root@autodl-container-f7da119752-d5d74c8f:~/autodl-tmp/w-plus-adapter-main# cd /root/autodl-tmp/w-plus-adapter-main ; /usr/bin/env /root/miniconda3/envs/py38w/bin/python /root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56819 -- train_face.py /root/miniconda3/envs/py38w/bin/python /root/.vscode-server/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56159 -- accelerate launch --config_file= 8_gpu.json --main_process_port= 25655 train_face.py --pretrained_model_name_or_path= ./stable-diffusion-v1-5 --data_json_file= None --data_root_path= None --mixed_precision= fp16 --resolution= 256 --train_batch_size= 1 --dataloader_num_workers= 1 --learning_rate= 1e-04\ --dataloader_num_workers= 1 --weight_decay 0.1 --output_dir= ./experimentsstage1${date_now} --save_steps= 50 usage: train_face.py [-h] --pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH --data_json_file DATA_JSON_FILE --data_root_path DATA_ROOT_PATH [--output_dir OUTPUT_DIR] [--logging_dir LOGGING_DIR] [--validation_steps VALIDATION_STEPS] [--resolution RESOLUTION] [--learning_rate LEARNING_RATE] [--weight_decay WEIGHT_DECAY] [--num_train_epochs NUM_TRAIN_EPOCHS] [--train_batch_size TRAIN_BATCH_SIZE] [--dataloader_num_workers DATALOADER_NUM_WORKERS] [--save_steps SAVE_STEPS] [--mixed_precision {no,fp16,bf16}] [--report_to REPORT_TO] [--local_rank LOCAL_RANK] train_face.py: error: the following arguments are required: --pretrained_model_name_or_path, --data_json_file, --data_root_path (py38w) root@autodl-container-f7da119752-d5d74c8f:~/autodl-tmp/w-plus-adapter-main#

=================================================== "--data_json_file" and "--data_root_path" are both set to "None" in both the sh file and the train.py file, and why wasn't the "--pretrained_model_name_or_path" parameter passed in? This is confusing to me. Thank you for any help you can provide. Alternatively, could you help me write a correct JSON file for debugging during training?

Sorry, I am not familiar with this debug process.

gaoyixuan111 commented 6 months ago

Thank you for your response. I have resolved the issue by ensuring compliance with the module usage rules when converting the .sh file to .json. I believe I will soon be able to cite your paper.