I am trying to follow this tutorial on training a text-to-image model in Google Colab. Unfortuantely, I am getting the error that the Colab environment is unable to find the model. If I send a request through a https request, I am able to connect to huggingface.co. I have also cloned the report. So I am not sure what the issue is.
Here is my working code:
from google.colab import drive
!pip install git+https://github.com/huggingface/diffusers.git
!pip install accelerate
import accelerate
from accelerate.utils import write_basic_config
write_basic_config()
!export MODEL_NAME="CompVis/stable-diffusion-v1-4"
!export dataset_name="lambdalabs/pokemon-blip-captions"
!accelerate launch --mixed_precision="fp16" train_text_to_image.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--dataset_name=$dataset_name \
--use_ema \
--checkpointing_steps=500 \
--resolution=512 --center_crop --random_flip \
--train_batch_size=1 \
--gradient_accumulation_steps=4 \
--gradient_checkpointing \
--max_train_steps=15000 \
--learning_rate=1e-05 \
--max_grad_norm=1 \
--lr_scheduler="constant" --lr_warmup_steps=0 \
--output_dir="sd-pokemon-model"
The error:
Traceback (most recent call last):
File “/usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py”, line 371, in load_config
config_file = hf_hub_download(
File “/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py”, line 110, in _inner_fn
validate_repo_id(arg_value)
File “/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py”, line 164, in validate_repo_id
raise HFValidationError(
huggingface_hub.utils.validators.HFValidationError: Repo id must use alphanumeric chars or ‘-’, '', ‘.’, ‘–’ and ‘…’ are forbidden, ‘-’ and ‘.’ cannot start or end the name, max length is 96: ‘’.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/content/drive/MyDrive/PROJ_FOLDER/train_text_to_image.py", line 1074, in <module>
main()
File "/content/drive/MyDrive/PROJ_FOLDER/train_text_to_image.py", line 551, in main
noise_scheduler = DDPMScheduler.from_pretrained(args.pretrained_model_name_or_path, subfolder="scheduler")
File "/usr/local/lib/python3.10/dist-packages/diffusers/schedulers/scheduling_utils.py", line 140, in from_pretrained
config, kwargs, commit_hash = cls.load_config(
File "/usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py", line 407, in load_config
raise EnvironmentError(
OSError: We couldn't connect to **INSERT HF URL HERE SINCE I CANT ADD MORE THAN 2 LINKS** to load this model, couldn't find it in the cached files and it looks like is not the path to a directory containing a scheduler_config.json file.
Checkout your internet connection or see how to run the library in offline mode at '**HF DOCS LINK**'.
Traceback (most recent call last):
File "/usr/local/bin/accelerate", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.py", line 47, in main
args.func(args)
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 994, in launch_command
simple_launcher(args)
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 636, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['...[all the commands]]