"vscode:/vscode.git/clone" did not exist on "102b5ff4a813eea848bb82ff2f451e0f6b17b30c"
Unverified Commit 468aed39 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Trainer`] Fix `.to` call on 4bit models (#24444)

* fix `.to` call on 4bit models

* better check
parent ea91c2ad
......@@ -493,7 +493,8 @@ class Trainer:
self.eval_dataset = eval_dataset
self.tokenizer = tokenizer
if self.place_model_on_device and not getattr(model, "is_loaded_in_8bit", False):
# Quantized models doesn't support `.to` operation.
if self.place_model_on_device and not getattr(model, "is_quantized", False):
self._move_model_to_device(model, args.device)
# Force n_gpu to 1 to avoid DataParallel as MP will manage the GPUs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment