Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: The current device_map had weights offloaded to the disk. #239

Closed
beratcmn opened this issue Apr 5, 2023 · 12 comments
Closed

Comments

@beratcmn
Copy link

beratcmn commented Apr 5, 2023

Here is the complete error message:

ValueError: The current `device_map` had weights offloaded to the disk. Please provide an `offload_folder` for 
them. Alternatively, make sure you have `safetensors` installed if the model you are using offers the weights in 
this format.

Error in the second line

from nomic.gpt4all.gpt4all import GPT4AllGPU
m = GPT4AllGPU("decapoda-research/llama-7b-hf")
@dxenos
Copy link

dxenos commented Apr 8, 2023

I have the same problem when I use the command line:
python generate.py --config configs/generate/generate.yaml --prompt "Write a script to reverse a string in Python"

here is my generate.yaml file:

# model/tokenizer
model_name: decapoda-research/llama-7b-hf # REPLACE HERE with the base llama model
tokenizer_name: "gpt2"  # REPLACE HERE with the llama tokenizer
lora: true
lora_path: "nomic-ai/gpt4all-lora"

max_new_tokens: 512
temperature: 0
prompt: null

I use a macbook pro Ventura 13.3

@clxyder
Copy link

clxyder commented Apr 13, 2023

This article has a pretty good explanation on how to fix that issue.

https://huggingface.co/blog/accelerate-large-models

@NewtonJr4108
Copy link

This article has a pretty good explanation on how to fix that issue.

https://huggingface.co/blog/accelerate-large-models

How would you apply the fix to running gpt4all command?

@clxyder
Copy link

clxyder commented Apr 27, 2023

This article has a pretty good explanation on how to fix that issue.

https://huggingface.co/blog/accelerate-large-models

How would you apply the fix to running gpt4all command?

I think you just add offload="offload" to the from_pretrained() call

@NewtonJr4108
Copy link

Thanks!

@chaitanya-uc
Copy link

@NewtonJr4108 did you fix this? If yes, how? Because we won't be explicitly calling the from_pretrained() method.
@clxyder

@Celppu
Copy link

Celppu commented May 16, 2023

I have same problem. How do i provide offload_folder ?

@sadidul012
Copy link

Here is a example of offload_folder, found here - https://huggingface.co/blog/accelerate-large-models

import torch
from transformers import AutoModelForCausalLM

# Will go out of RAM on Colab
checkpoint = "facebook/opt-13b"
model = AutoModelForCausalLM.from_pretrained(
    checkpoint, device_map="auto", offload_folder="offload", torch_dtype=torch.float16
)

@helperton
Copy link

helperton commented Aug 10, 2023

mkdir offload

Then inside of your python code,

model = AutoModelForCausalLM.from_pretrained(
...
...
offload_folder="/path/to/your/offload"
)

@niansa
Copy link
Contributor

niansa commented Aug 11, 2023

Stale? Please open a new issue if this is still relevant.

@djdylex
Copy link

djdylex commented Feb 26, 2024

I supplied a folder, double checked the path and everything - still same issue. Not sure what's going on. I'm using transform.from_pretrainer().

@cebtenzzre
Copy link
Member

GPT4AllGPU is no longer provided by this repo, and is not supported by Nomic anymore.

@nomic-ai nomic-ai locked as resolved and limited conversation to collaborators Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests