Skip to content

Documentation: Default ckpt filepath and Instructions for ckpt filepath are not equivalent #371

@amdreallyfast

Description

@amdreallyfast

Instructions say to run this:

mkdir -p models/ldm/stable-diffusion-v1/
ln -s <path/to/model.ckpt> models/ldm/stable-diffusion-v1/model.ckpt 
python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms

This results in an error:

Loading model from /data/pretrained_models/ldm/text2img-large/model.ckpt
Traceback (most recent call last):
  File "scripts/txt2img.py", line 119, in <module>
    model = load_model_from_config(config, opt.ckpt_path)  # TODO: check path
  File "scripts/txt2img.py", line 16, in load_model_from_config
    pl_sd = torch.load(ckpt, map_location="cpu")
  File "C:\Users\<redacted>\anaconda3\envs\ldm\lib\site-packages\torch\serialization.py", line 594, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "C:\Users\<redacted>\anaconda3\envs\ldm\lib\site-packages\torch\serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "C:\Users\<redacted>\anaconda3\envs\ldm\lib\site-packages\torch\serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/data/pretrained_models/ldm/text2img-large/model.ckpt'

The path to the .ckpt file is due to the default argument setting:

    parser.add_argument(
        "--ckpt_path", 
        type=str, 
        default="/data/pretrained_models/ldm/text2img-large/model.ckpt", 
        help="Path to pretrained ldm text2img model")

Which path should be used? The one in the instructions? The one in the argument parsing?

Also, that default file path is not portable to Windows. Is it possible to use a relative path instead so that it is portable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions