Skip to content

Retrieve.py throwing error when following training example on Custom diffusion on hugging face #3627

@nighting0le01

Description

@nighting0le01

Describe the bug

Retrieve.py script has issues

Reproduction

follow the instructions on custom diffusion training and run it in a python 3.8 conda env.
https://huggingface.co/docs/diffusers/main/en/training/custom_diffusion

Logs

(diff) ubuntu@ip-96-107-149-234:~/project/custom-diffusion_expts/diffusers/examples/custom_diffusion$ python retrieve.py --class_prompt cat --class_data_dir real_reg/samples_cat --num_class_images 200
Traceback (most recent call last):
  File "/opt/conda/envs/diff/lib/python3.8/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/conda/envs/diff/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/opt/conda/envs/diff/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/conda/envs/diff/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 "retrieve.py", line 87, in <module>
    retrieve(args.class_prompt, args.class_data_dir, args.num_class_images)
  File "retrieve.py", line 37, in retrieve
    class_images = client.query(text=class_prompt)
  File "/opt/conda/envs/diff/lib/python3.8/site-packages/clip_retrieval/clip_client.py", line 84, in query
    return self.__search_knn_api__(text=text)
  File "/opt/conda/envs/diff/lib/python3.8/site-packages/clip_retrieval/clip_client.py", line 131, in __search_knn_api__
    return requests.post(
  File "/opt/conda/envs/diff/lib/python3.8/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

System Info

Python version 3.8

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