rinongal / textual_inversion

MIT License
2.87k stars 278 forks source link

Error when running Inversion script #154

Open macrocredit opened 1 year ago

macrocredit commented 1 year ago

Hi - When running the inversion script I have the following error:

python3 main.py --base configs/latent-diffusion/txt2img-1p4B-finetune.yaml -t --actual_resume /scratch/xyz/textual_inversion/models/ldm/text2img-large/model.ckpt -n run_2 --gpus 0,1,2,3 --data_root /scratch/xyz/textual_inversion/img/datasets/cat_statue --init_word cat"

I got the following error: raise MisconfigurationException(f"No {loader_name}() method defined to run Trainer.{trainer_method}.") pytorch_lightning.utilities.exceptions.MisconfigurationException: No test_dataloader() method defined to run Trainer.test.

This is under this line:

_if not opt.notest and not trainer.interrupted:
trainer.test(model, data)

Is there any lead to remedy this error? Thanks.

rinongal commented 1 year ago

Is this happening after your training is done? Do you still get the output images / checkpoints?

hanikh commented 1 year ago

I got the same error. it happened before the training process got started.

rinongal commented 1 year ago

@hanikh I can't seem to reproduce this with my current setup. Can you try re-running with the --no-test flag and let me know if that helps?

justinday123 commented 1 year ago

i got the same issue. it happened at training process(actually, it happened at 48th epoch).

justinday123 commented 1 year ago

@rinongal when i run with the --no-test flag, it stops at the same point(48th epoch)

rinongal commented 1 year ago

@justinday123 Can you try modifying your config file by copying validation block and changing it's name to test? So your data block would look something like this:

data:
  target: main.DataModuleFromConfig
  params:
    batch_size: 2
    num_workers: 2
    wrap: false
    train:
      target: ldm.data.personalized.PersonalizedBase
      params:
        size: 512
        set: train
        per_image_tokens: false
        repeats: 100
    validation:
      target: ldm.data.personalized.PersonalizedBase
      params:
        size: 512
        set: val
        per_image_tokens: false
        repeats: 10
    test:
      target: ldm.data.personalized.PersonalizedBase
      params:
        size: 512
        set: val
        per_image_tokens: false
        repeats: 10

If that doesn't help, could you let me know what versions of pytorch, pytorch lightning, transformers and xformers you are using? And if possible, please give me the full error stack trace.