OverflowError: cannot fit 'int' into an index-sized integer

#171
by CoderGfy2000 - opened

Why do I always get this error when I download the model locally? Has anyone encountered this?

Below this is my code:

from diffusers import DiffusionPipeline
import torch
print(torch.cuda.is_available())

load both base & refiner

base = DiffusionPipeline.from_pretrained(
"./models/stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
use_safetensors=True,
use_auth_token="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"
)
base.to("cuda")
refiner = DiffusionPipeline.from_pretrained(
"./models/stabilityai/stable-diffusion-xl-refiner-1.0",
text_encoder_2=base.text_encoder_2,
vae=base.vae,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16",
)
refiner.to("cuda")

Define how many steps and what % of steps to be run on each experts (80/20) here

n_steps = 40
high_noise_frac = 0.8

prompt = "A majestic lion jumping from a big stone at night"

run both experts

image = base(
prompt=prompt,
num_inference_steps=n_steps,
denoising_end=high_noise_frac,
output_type="latent",
).images
image = refiner(
prompt=prompt,
num_inference_steps=n_steps,
denoising_start=high_noise_frac,
image=image,
).images[0]

image.save("output_image.png")

The error message is as follows:

PS C:\Users\Coder\Desktop\test> & C:/Users/Coder/.conda/envs/sd_xl_base_1.0/python.exe c:/Users/Coder/Desktop/test/local_en-test.py
True
Keyword arguments {'use_auth_token': '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'} are not expected by StableDiffusionXLPipeline and will be ignored.
Loading pipeline components...: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7/7 [00:00<00:00, 8.23it/s]
Loading pipeline components...: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5/5 [00:00<00:00, 14.89it/s]
Traceback (most recent call last):
File "c:\Users\Coder\Desktop\test\local_en-test.py", line 31, in
image = base(
^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\diffusers\pipelines\stable_diffusion_xl\pipeline_stable_diffusion_xl.py", line 1054, in call
) = self.encode_prompt(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\diffusers\pipelines\stable_diffusion_xl\pipeline_stable_diffusion_xl.py", line 363, in encode_prompt
text_inputs = tokenizer(
^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils_base.py", line 2883, in call
encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils_base.py", line 2969, in _call_one
return self.batch_encode_plus(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils_base.py", line 3160, in batch_encode_plus
return self._batch_encode_plus(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils.py", line 807, in _batch_encode_plus
batch_outputs = self._batch_prepare_for_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils.py", line 879, in _batch_prepare_for_model
batch_outputs = self.pad(
^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils_base.py", line 3367, in pad
outputs = self._pad(
^^^^^^^^^^
File "C:\Users\Coder.conda\envs\sd_xl_base_1.0\Lib\site-packages\transformers\tokenization_utils_base.py", line 3736, in _pad
encoded_inputs["attention_mask"] = encoded_inputs["attention_mask"] + [0] * difference
~~~~^~~~~~~~~~~~
OverflowError: cannot fit 'int' into an index-sized integer
PS C:\Users\Coder\Desktop\test>

Sign up or log in to comment