GaParmar / img2img-turbo

One-step image-to-image with Stable Diffusion turbo: sketch2image, day2night, and more
MIT License
1.62k stars 186 forks source link

keyerror:no clip_txt_model #11

Open a1122446488 opened 7 months ago

a1122446488 commented 7 months ago

When I run Python gradio_canny2image.py, keyerror: no clip_txt_model appears. How should I download this

GaParmar commented 7 months ago

Hi,

Could you provide the exact error message that you encountered?

-Gaurav

a1122446488 commented 7 months ago

Hello, I'm here https://huggingface.co/stabilityai/sd-turbo/tree/main Download relevant files directly from the website, but encounter these issues during runtime Traceback (most recent call last): Traceback (most recent call last): File "E:\Codes\sc\img2img-turbo-main\img2img-turbo-main\gradio_canny2image.py", line 8, in model = Pix2Pix_Turbo("edge_to_image") File "E:\Codes\sc\img2img-turbo-main\img2img-turbo-main\src\pix2pix_turbo.py", line 31, in init self.tokenizer = AutoTokenizer.from_pretrained("stabilityai/sd-turbo", subfolder="tokenizer") File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 733, in from_pretrained config = AutoConfig.from_pretrained( File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\models\auto\configuration_auto.py", line 1064, in from_pretrained config_class = CONFIG_MAPPING[config_dict["model_type"]] File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\models\auto\configuration_auto.py", line 761, in getitem raise KeyError(key) KeyError: 'clip_text_model'

GaParmar commented 7 months ago

It looks like you have some issues with downloading the SD-Turbo model. Could you try deleting the cached sd-turbo model and run these commands to see if it gets downloaded correctly:

from diffusers import AutoencoderKL, UNet2DConditionModel
tokenizer = AutoTokenizer.from_pretrained("stabilityai/sd-turbo", subfolder="tokenizer")
a1122446488 commented 7 months ago

Is the download of the SD Tyrbo model from https://huggingface.co/stabilityai/sd-turbo/tree/main Just install all of them directly and create them in the stablityai file?

GaParmar commented 7 months ago

You should not need to download the model manually from the website. The model should get downloaded automatically when you run the command above.

a1122446488 commented 7 months ago

But when I run Python graphic_cannoy2image.py without downloading it, Traceback (most recent call last) will appear: File "E:\Codes\sc\img2img-turbo-main\img2img-turbo-main\gradio_canny2image.py", line 8, in model = Pix2Pix_Turbo("edge_to_image") File "E:\Codes\sc\img2img-turbo-main\img2img-turbo-main\src\pix2pix_turbo.py", line 31, in init self.tokenizer = AutoTokenizer.from_pretrained("stabilityai/sd-turbo", subfolder="tokenizer") File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 733, in from_pretrained config = AutoConfig.from_pretrained( File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\models\auto\configuration_auto.py", line 1048, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, kwargs) File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\configuration_utils.py", line 622, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, kwargs) File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\configuration_utils.py", line 677, in _get_config_dict resolved_config_file = cached_file( File "C:\ProgramData\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\utils\hub.py", line 470, in cached_file raise EnvironmentError( OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like stabilityai/sd-turbo is not the path to a directory containing a file named tokenizer\config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

GaParmar commented 7 months ago

Ah, that is unexpected, maybe you have some network connection issues?

a1122446488 commented 7 months ago

So I can just go straight to the https://huggingface.co/stabilityai/sd-turbo/tree/main Is it running after manual installation on?

GaParmar commented 7 months ago

I have not tried using huggingface in offline mode. Maybe this thread might be helpful? https://github.com/huggingface/transformers/issues/11231

a1122446488 commented 7 months ago

Okay, I'll give it a try. Thank you very much

wangwenqiao666 commented 7 months ago

https://www.cs.cmu.edu/~img2img-turbo/models/sketch_to_image_stochastic_lora.pkl https://www.cs.cmu.edu/~img2img-turbo/models/edge_to_image_loras.pkl download model in ./checkpoints.

447425299 commented 6 months ago

Hello, @a1122446488 , I was wondering if you had managed to resolve the issue mentioned above. If indeed you have, I would greatly appreciate it if you could kindly share the steps you took to arrive at a solution.

Thank you very much for your assistance.

kanekiCY commented 4 months ago

Hello, @a1122446488 , I was wondering if you had managed to resolve the issue mentioned above. If indeed you have, I would greatly appreciate it if you could kindly share the steps you took to arrive at a solution.

Thank you very much for your assistance.

This problem can be solved by downloading all the files in the SD Turbo directory and organizing them according to the directory format on the webpage.