Skip to content

Dreambooth can not load intermedia checkpoint #3379

Closed
@g-jing

Description

@g-jing

Describe the bug

I am training dreambooth and want to use the intermedia checkpoint-500 following [this](https://huggingface.co/docs/diffusers/training/dreambooth#:~:text=v1%2D4%22%0A%0Aunet%20%3D-,UNet2DConditionModel,-.from_pretrained(%22/sddata).

However it cannot load the submodule unet:

Reproduction

unet = UNet2DConditionModel.from_pretrained("/home/jingg/dreambooth/dreambooth-alvan-nee/checkpoint-500/")

Logs

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[2], line 6
      2 model_id = "stabilityai/stable-diffusion-2-1-base"
      4 model_path = "/home/jingg/diffusers/examples/dreambooth/dreambooth-alvan-nee/checkpoint-500/"
----> 6 unet = UNet2DConditionModel.from_pretrained("/home/jingg/dreambooth/dreambooth-alvan-nee/checkpoint-500/")
      8 # if you have trained with `--args.train_text_encoder` make sure to also load the text encoder
      9 text_encoder = CLIPTextModel.from_pretrained(model_path + "text_encoder")

File /opt/conda/lib/python3.8/site-packages/diffusers/models/modeling_utils.py:494, in ModelMixin.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    487 user_agent = {
    488     "diffusers": __version__,
    489     "file_type": "model",
    490     "framework": "pytorch",
    491 }
    493 # load config
--> 494 config, unused_kwargs, commit_hash = cls.load_config(
    495     config_path,
    496     cache_dir=cache_dir,
    497     return_unused_kwargs=True,
    498     return_commit_hash=True,
    499     force_download=force_download,
    500     resume_download=resume_download,
    501     proxies=proxies,
    502     local_files_only=local_files_only,
    503     use_auth_token=use_auth_token,
    504     revision=revision,
    505     subfolder=subfolder,
    506     device_map=device_map,
    507     user_agent=user_agent,
    508     **kwargs,
    509 )
    511 # load model
    512 model_file = None

File /opt/conda/lib/python3.8/site-packages/diffusers/configuration_utils.py:350, in ConfigMixin.load_config(cls, pretrained_model_name_or_path, return_unused_kwargs, return_commit_hash, **kwargs)
    348         config_file = os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
    349     else:
--> 350         raise EnvironmentError(
    351             f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."
    352         )
    353 else:
    354     try:
    355         # Load from URL or cache if already cached

OSError: Error no file named config.json found in directory /home/jingg/dreambooth/dreambooth-alvan-nee/checkpoint-500/.

System Info

  • diffusers version: 0.16.1
  • Platform: Linux-5.15.0-1015-aws-x86_64-with-glibc2.17
  • Python version: 3.8.12
  • PyTorch version (GPU?): 2.0.0+cu117 (True)
  • Huggingface_hub version: 0.13.3
  • Transformers version: 4.28.1
  • Accelerate version: 0.18.0
  • xFormers version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions