私的AI研究会 > AI_Program4
これまで検証してきた結果をもとに、Python で生成 AI プログラムを書く
画像生成のプログラムを書く |
(base) PS > conda activate sd_test (sd_test) PS > cd workspace_3/sd_test
Step | プログラム | GPU | CPU | |||||
RTX 4070Ti | RTX 4060 | RTX 4060L | RTX 3050 | GTX 1050 | i7-1260P | |||
50 | 顔の崩れを修正する1 | sd_050.py | 00:01 | 00:03 | 00:10 | 00:05 | 00:37 | 02:12 |
51 | 顔の崩れを修正する2「ADetailer」 | sd_051.py | 00:01 | 00:03 | 00:03 | 00:05 | 00:34 | 03:35 |
52 | 画像の一部を変換する「Paint-By-Example」 | sd_052.py | 00:02 | 00:05 | 00:13 | 00:15 | 02:51 | 04:03 |
conda install dlib -c conda-forge
pip install face_recognition
python sd_050.py
(sd_test) PS > python sd_050.py Stable Diffusion with diffusers(050) Ver 0.06: Starting application... --result_image : results/image_050.png --cpu : False --log : 3 --model_dir : /StabilityMatrix/Data/Models/StableDiffusion --model_path : SD1.5/beautifulRealistic_brav5.safetensors --image_path : images/sd_050_test.jpg --max_size : 0 --prompt : masterpiece, high quality, very_high_resolution, large_filesize, full color, an extremely cute face, woman, symmetrical, HDR, real, realistic --seed : 12345678 --width : 512 --height : 512 --step : 20 --scale : 8.5 --strength : 0.4 --neg_prompt : lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, multiple legs, malformation Fetching 11 files: 100%|███████████████████████████████| 11/11 [00:00<?, ?it/s] Loading pipeline components...: 100%|████████████| 6/6 [00:00<00:00, 19.56it/s] 100%|██████████████████████████████████████████| 20/20 [00:02<00:00, 9.50it/s] result_file: results/image_050.png Finished.
pip install asdff
python sd_051.py
(sd_test) PS > python sd_051.py Stable Diffusion with diffusers(sd_051) Ver 0.06: Starting application... --result_image : results/image_051.png --cpu : False --log : 3 --model_dir : /StabilityMatrix/Data/Models/StableDiffusion --model_path : SD1.5/beautifulRealistic_brav5.safetensors --image_path : D:/anaconda_win/workspace_3/sd_test/images/sd_050_test.jpg --max_size : 0 --prompt : masterpiece, best quality, 1girl --seed : 12345678 --step : 30 = ADetailer = prompt: 'masterpiece, best quality, 1girl' model: 'face_yolov8s.pt' Fetching 11 files: 100%|███████████████████████████████| 11/11 [00:00<?, ?it/s] Loading pipeline components...: 100%|████████████| 6/6 [00:00<00:00, 19.93it/s] 0: 640x512 1 face, 36.0ms Speed: 2.3ms preprocess, 36.0ms inference, 61.3ms postprocess per image at shape (1, 3, 640, 512) 100%|██████████████████████████████████████████| 12/12 [00:01<00:00, 9.07it/s] 0: 640x512 1 face, 23.9ms Speed: 1.3ms preprocess, 23.9ms inference, 2.0ms postprocess per image at shape (1, 3, 640, 512) 100%|██████████████████████████████████████████| 12/12 [00:01<00:00, 9.17it/s] result_file: results/image_051-sd_050_test.png Finished.
python sd_052.py
(sd_test) PS > python sd_052.py Stable Diffusion with diffusers(052) Ver 0.06: Starting application... --result_image : results/image_052.png --cpu : False --log : 3 --model_path : Fantasy-Studio/Paint-by-Example --image_path : images/heron.jpg --ctrl_image_path : images/kamo.jpg --max_size : 0 --seed : -1 --width : 512 --height : 512 --step : 20 Loading pipeline components...: 0%| | 0/5 [00:00<?, ?it/s]An error occurred while trying to fetch C:\Users\izuts\.cache\huggingface\hub\models--Fantasy-Studio--Paint-by-Example\snapshots\351e6427d8c28a3b24f7c751d43eb4b6735127f7\vae: Error no file named diffusion_pytorch_model.safetensors found in directory C:\Users\izuts\.cache\huggingface\hub\models--Fantasy-Studio--Paint-by-Example\snapshots\351e6427d8c28a3b24f7c751d43eb4b6735127f7\vae. An error occurred while trying to fetch C:\Users\izuts\.cache\huggingface\hub\models--Fantasy-Studio--Paint-by-Example\snapshots\351e6427d8c28a3b24f7c751d43eb4b6735127f7\unet: Error no file named diffusion_pytorch_model.safetensors found in directory C:\Users\izuts\.cache\huggingface\hub\models--Fantasy-Studio--Paint-by-Example\snapshots\351e6427d8c28a3b24f7c751d43eb4b6735127f7\unet. Loading pipeline components...: 40%|████████████████████▊ | 2/5 [00:00<00:00, 7.84it/s]You are using a model of type clip_vision_model to instantiate a model of type clip. This is not supported for all configurations of models and can yield errors. Loading pipeline components...: 100%|█████████████| 5/5 [00:00<00:00, 5.47it/s] 100%|███████████████████████████████████████████| 20/20 [00:05<00:00, 3.76it/s] result_file: results/image_052-388208840.png Finished.