How to load training_args

Hi
I wonder how I can load the training_args.bin?
thanks

it’s saved with torch so you can just do training_args = torch.load(path_to_training_args)

3 Likes

is it possible to push the training_args to the hub? tried push_to_hub and got the below error:
“bool object is not callable”

push_to_hub is an argument of the TrainingArguments class, not a method. The training arguments will be automatically pushed to the Hub with everything inside the Trainer when you do Trainer.push_to_hub().

2 Likes

have we use cuda for this? what if we just want to load it with cpu? I got some error.
self.trainer = Trainer(
model=model.to(self.device),
args=torch.load(config[“DISTIL_BERT_TRAINING_ARGS”], map_location=self.device)
)

the error

self.trainer = Trainer(
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\transformers\trainer.py”, line 438, in init
self._move_model_to_device(model, args.device)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\transformers\trainer.py”, line 681, in _move_model_to_device
model = model.to(device)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 987, in to
return self._apply(convert)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 639, in _apply
module._apply(fn)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 639, in _apply
module._apply(fn)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 639, in _apply
module._apply(fn)
[Previous line repeated 1 more time]
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 662, in apply
param_applied = fn(param)
File “C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\nn\modules\module.py”, line 985, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
File "C:\Users\jabal.virtualenvs\bert-api-Li17HIRV\lib\site-packages\torch\cuda_init
.py", line 221, in _lazy_init
raise AssertionError(“Torch not compiled with CUDA enabled”)
AssertionError: Torch not compiled with CUDA enabled