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

ms_wrapper.py have wrong, device_map had weights offloaded to the disk #10

Open
toniedeng opened this issue Apr 14, 2024 · 1 comment
Open

Comments

@toniedeng
Copy link

class SunsimiaoTextGeneration(TorchModel):
def init(self, model_dir=None, *args, **kwargs):
super().init(model_dir, *args, **kwargs)
self.logger = get_logger()
# loading tokenizer
self.tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
self.model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True)
self.model = self.model.eval()

Message=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.
Source=C:\Users\Administrator.cache\modelscope\modelscope_modules\Sunsimiao\ms_wrapper.py
StackTrace:
File "C:\Users\Administrator.cache\modelscope\modelscope_modules\Sunsimiao\ms_wrapper.py", line 42, in init
self.model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True)
File "C:\Users\Administrator.cache\modelscope\modelscope_modules\Sunsimiao\ms_wrapper.py", line 20, in init (Current frame)
model = SunsimiaoTextGeneration(model) if isinstance(model, str) else model
File "C:\Users\Administrator\source\repos\Sunsimiao\scripts\inference_ms.py", line 4, in
pipe = pipeline(task=Tasks.text_generation,

@jingnant
Copy link
Contributor

可能是由于显存不足,尝试在model给offload_folder参数
self.model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True,offload_folder="offload_folder")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants