adobe-research / custom-diffusion

Custom Diffusion: Multi-Concept Customization of Text-to-Image Diffusion (CVPR 2023)
https://www.cs.cmu.edu/~custom-diffusion
Other
1.87k stars 139 forks source link

NameError: name 'trainer' is not defined #99

Open wenkfjsf opened 1 month ago

wenkfjsf commented 1 month ago

bash scripts/finetune_real.sh "cat" data/cat real_reg/samples_cat cat finetune_addtoken.yaml '/media/nlp/data/custom-diffusion/stable-diffusion-v-1-4-original/sd-v1-4.ckpt' cat data/cat real_reg/samples_cat cat finetune_addtoken.yaml /media/nlp/data/custom-diffusion/stable-diffusion-v-1-4-original/sd-v1-4.ckpt Traceback (most recent call last): File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "src/retrieve.py", line 92, in retrieve(args.target_name, args.outpath, args.num_class_images) File "src/retrieve.py", line 28, in retrieve results = client.query(text=target_name) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/clip_retrieval/clip_client.py", line 84, in query return self.search_knn_api(text=text) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/clip_retrieval/clip_client.py", line 131, in search_knn_api return requests.post( File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Global seed set to 23 Running on GPUs 0,1 CustomDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Traceback (most recent call last): File "train.py", line 764, in st = torch.load(opt.resume_from_checkpoint_custom, map_location='cpu')["state_dict"] File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/torch/serialization.py", line 713, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/nlp/anaconda3/envs/ldm/lib/python3.8/site-packages/torch/serialization.py", line 920, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 987, in if trainer.global_rank == 0: NameError: name 'trainer' is not defined I encountered the above problem while implementing the code and asked for an answer