Skip to content

config files missed for training naive text-to-image model #2185

@JunMa11

Description

@JunMa11

Describe the bug

I used the following command to train a naive text-to-image model and the training process goes well.

Here are files in the model folder

pytorch_model.bin  optimizer.bin        scaler.pt
random_states_0.pkl  scheduler.bin

However, during inference, it raises errors on missing config files.

OSError: Error no file named model_index.json found in directory path_to/text2Euro-naive/checkpoint-4000.

I manually download model_index.json from https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/model_index.json and put it into the model folder.

A new error occurred:

Error no file named scheduler_config.json found in directory path_to/text2Euro-naive/checkpoint-4000.

How can I find these missed files for model inference?

Reproduction

export MODEL_NAME="stabilityai/stable-diffusion-2-1-base"
export TRAIN_DIR="./data/train"
export OUTPUT_DIR="./text2Euro-naive"

accelerate launch --mixed_precision="fp16"  train_naive_T2I.py \
  --pretrained_model_name_or_path=$MODEL_NAME  \
  --train_data_dir=$TRAIN_DIR \
  --output_dir=$OUTPUT_DIR \
  --train_batch_size=1 \
  --gradient_accumulation_steps=4 \
  --gradient_checkpointing \
  --max_train_steps=30000 \
  --learning_rate=1e-05 \
  --max_grad_norm=1 \
  --lr_scheduler="constant" --lr_warmup_steps=0 \

Inference

from diffusers import StableDiffusionPipeline
import torch

model_path = "path_to/text2Euro-naive/checkpoint-4000"
pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16)
pipe.to("cuda")

Logs

OSError: Error no file named model_index.json found in directory path_to/text2Euro-naive/checkpoint-4000.

> Error no file named scheduler_config.json found in directory path_to/text2Euro-naive/checkpoint-4000.

System Info

  • diffusers version: 0.10.2
  • Platform: Linux-5.13.0-39-generic-x86_64-with-glibc2.31
  • Python version: 3.9.15
  • PyTorch version (GPU?): 1.13.0+cu117 (True)
  • Huggingface_hub version: 0.11.1
  • Transformers version: 4.25.1
  • 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