🚩 Report
hey i have been trying to you compvis sd v1.4 in my code but fails to authenticate.. even through i have provided with both type of read and write token. but non works.
Is their anyting from you does it require to authenticate or does this huggingface does it as mediator.
Pls response with suggestions and guidelines.. im new in this space.
Though i do hv agreed to checkboxs on your pages to provide contact info, but thats too not working.
0it [00:00, ?it/s]
0it [00:00, ?it/s]
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/diffusers/configuration_utils.py", line 218, in get_config_dict
config_file = hf_hub_download(
File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1078, in hf_hub_download
raise EnvironmentError(
OSError: You specified use_auth_token=True, but a huggingface token was not found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 12, in
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
File "/home/user/.local/lib/python3.8/site-packages/diffusers/pipeline_utils.py", line 290, in from_pretrained
config_dict = cls.get_config_dict(
File "/home/user/.local/lib/python3.8/site-packages/diffusers/configuration_utils.py", line 263, in get_config_dict
raise EnvironmentError(
OSError: Can't load config for 'CompVis/stable-diffusion-v1-4'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'CompVis/stable-diffusion-v1-4' is the correct path to a directory containing a model_index.json file
Can you please share what code is throwing this errors?
from torch import autocast
import requests
import torch
from PIL import Image
from io import BytesIO
from diffusers import StableDiffusionImg2ImgPipeline
load the pipeline
device = "cuda"
model_id_or_path = "CompVis/stable-diffusion-v1-4"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
model_id_or_path,
revision="fp16",
torch_dtype=torch.float16,
use_auth_token=True
)
or download via git clone https://huggingface.co/CompVis/stable-diffusion-v1-4
and pass model_id_or_path="./stable-diffusion-v1-4"
without having to use use_auth_token=True
.
pipe = pipe.to(device)
let's download an initial image
response = requests.get(url)
init_image = Image.open(BytesIO(response.content)).convert("RGB")
init_image = init_image.resize((768, 512))
prompt = "Lively, illustration of a [[[king::4]]], portrait, fantasy, intricate, Scenic, hyperdetailed, hyper realistic , unreal engine, 4k, smooth, sharp focus, intricate, cinematic lighting, highly detailed, octane, digital painting, artstation, concept art, vibrant colors, Cinema4D, WLOP, 3d render, in the style of hearthstone::5 art by Artgerm and greg rutkowski and magali villeneuve, martina jackova, Giger"
with autocast("cuda"):
images = pipe(prompt=prompt, init_image=init_image, strength=0.75, guidance_scale=7.5).images
images[0].save("fantasy_landscape.png")
many times it also throws following error..
OSError: You specified use_auth_token=True, but a Hugging Face token was not found.
Can you please share what code is throwing this errors?
any idea ?
Has solved above problem.. now i'm getting this RuntimeError
.....................................................................................................
File "app.py", line 22, in
img_pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
File "/home/user/app/src/diffusers/src/diffusers/pipeline_utils.py", line 383, in from_pretrained
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "/home/user/app/src/diffusers/src/diffusers/configuration_utils.py", line 160, in from_config
model = cls(**init_dict)
File "/home/user/app/src/diffusers/src/diffusers/configuration_utils.py", line 382, in inner_init
init(self, *args, **init_kwargs)
File "/home/user/app/src/diffusers/src/diffusers/schedulers/scheduling_pndm.py", line 131, in init
self.set_format(tensor_format=tensor_format)
File "/home/user/app/src/diffusers/src/diffusers/schedulers/scheduling_utils.py", line 53, in set_format
setattr(self, key, torch.from_numpy(value).to(device='cuda:0'))
File "/home/user/.local/lib/python3.8/site-packages/torch/cuda/init.py", line 217, in _lazy_init
torch._C._cuda_init()
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/streamlit/scriptrunner/script_runner.py", line 554, in _run_script
exec(code, module.dict)
File "/home/user/app/app.py", line 33, in
gr.Interface(fn=infer, inputs=[gr.Image(source="upload", type="filepath", label="Raw Image"), gr.Textbox(label = 'Prompt Input Text'),
AttributeError: module 'gradio' has no attribute 'Image'
same issue running this Google Colab Notebook:
https://colab.research.google.com/github/dmarx/video-killed-the-radio-star/blob/main/Video_Killed_The_Radio_Star_Defusion.ipynb
to reproduce uncheck 'use stability_api' and provide your Hugging Face read token, when prompted
actually you need to provide a token key in your hugging face space 'repo secrets'.
for that please go to 'settings' page option of your selected 'spaces' & add 'Name'(token name) & 'Value'(token key) in 'Repo secrets' to 'Create a Secrete' and use the token for authentication.
any fix @neurosurg ?