mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
add no_split_module_classes to prevent tensor split error
This commit is contained in:
parent
ab47044459
commit
9fbd60bf22
@ -118,7 +118,7 @@ def load_model(model_name):
|
|||||||
max_memory['cpu'] = f"{shared.args.cpu_memory or '99'}GiB"
|
max_memory['cpu'] = f"{shared.args.cpu_memory or '99'}GiB"
|
||||||
|
|
||||||
import accelerate
|
import accelerate
|
||||||
device_map = accelerate.infer_auto_device_map(model, max_memory=max_memory)
|
device_map = accelerate.infer_auto_device_map(model, max_memory=max_memory, no_split_module_classes=["LLaMADecoderLayer"])
|
||||||
model = accelerate.dispatch_model(model, device_map=device_map)
|
model = accelerate.dispatch_model(model, device_map=device_map)
|
||||||
else:
|
else:
|
||||||
model = model.to(torch.device('cuda:0'))
|
model = model.to(torch.device('cuda:0'))
|
||||||
|
Loading…
Reference in New Issue
Block a user