HFValidationError
#1
by
KunCheng
- opened
I try to run the example code [https://huggingface.co/openbmb/VisCPM-Paint#how-to-use] to test VisCPM-paint, but got this error:
Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/data/codes/VisCPM'. Use `repo_type` argument if needed.
File "/data/ck/codes/diffusion/VisCPM/test_diffusers.py", line 11, in <module>
pipeline = DiffusionPipeline.from_pretrained('openbmb/VisCPM-Paint', custom_pipeline="pipeline_stable_diffusion.py", text_encoder=text_encoder, tokenizer=tokenizer)
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/data/codes/VisCPM'. Use `repo_type` argument if needed.
How to solve this error ?
Thanks
Hello, we have fixed the problem, please use the following code and try again. If you find any other problems, please give us more information.
#!/usr/bin/env python
# encoding: utf-8
from diffusers import DiffusionPipeline
from transformers import AutoModel
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('openbmb/VisCPM-Paint', trust_remote_code=True)
text_encoder = AutoModel.from_pretrained('openbmb/VisCPM-Paint', trust_remote_code=True)
print('load pipeline')
pipeline = DiffusionPipeline.from_pretrained('openbmb/VisCPM-Paint', custom_pipeline="openbmb/VisCPM-Paint", text_encoder=text_encoder, tokenizer=tokenizer)
pipeline = pipeline.to('cuda')
prompt = "a photo of an astronaut riding a horse on mars"
image = pipeline(prompt).images[0]
image.save("astronaut_rides_horse.png")