# Error while loading the model using safe tensors

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-loading-the-model-using-safe-tensors%2F46458%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 11, 2023, 4:32pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-loading-the-model-using-safe-tensors%2F46458 "2023-07-11T16:32:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tasheer10](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@tasheer10](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftasheer10)%5C
**Post date:** [July 11, 2023, 4:32pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-loading-the-model-using-safe-tensors%2F46458%2F1 "2023-07-11T16:32:51Z")

</div>

Getting the following error while executing the following code :  
pipe = pipeline(“text-generation”, model=“HuggingFaceH4/starchat-beta”, torch\_dtype=torch.bfloat16, device\_map=“auto”)

Error:  
Traceback (most recent call last):  
File “”, line 1, in   
File “/data/user/.local/lib/python3.8/site-packages/transformers/pipelines / **init**.py”, line 779, in pipeline  
framework, model = infer\_framework\_load\_model(  
File “/data/user/.local/lib/python3.8/site-packages/transformers/pipelines /base.py”, line 262, in infer\_framework\_load\_model  
model = model\_class.from\_pretrained(model, \*\*kwargs)  
File “/data/user/.local/lib/python3.8/site-packages/transformers/models/au to/auto\_factory.py”, line 471, in from\_pretrained  
return model\_class.from\_pretrained(  
File “/data/user/.local/lib/python3.8/site-packages/transformers/modeling\_ utils.py”, line 2795, in from\_pretrained  
) = cls._load\_pretrained\_model(  
File "/data/user/.local/lib/python3.8/site-packages/transformers/modeling_ utils.py", line 3109, in _load\_pretrained\_model  
state\_dict = load\_state\_dict(shard\_file)  
File "/data/user/.local/lib/python3.8/site-packages/transformers/modeling_ utils.py", line 440, in load\_state\_dict  
return safe\_load\_file(checkpoint\_file)  
File “/data/user/.local/lib/python3.8/site-packages/safetensors/torch.py”, line 261, in load\_file  
result[k] = f.get\_tensor(k)  
RuntimeError: Viewing a tensor as a new dtype with a different number of bytes p er element is not supported.
