# How to load training\_args

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%3E%5C
**Category:** Beginners\
**Created:** [April 23, 2021, 11:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720 "2021-04-23T11:21:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dara](https://avatars.discourse-cdn.com/v4/letter/d/f14d63/32.png) [@Dara](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FDara)%5C
**Post date:** [April 23, 2021, 11:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F1 "2021-04-23T11:21:49Z")

</div>

Hi  
I wonder how I can load the training\_args.bin?  
thanks

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [April 23, 2021, 1:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F2 "2021-04-23T13:12:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nickmuchi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nickmuchi/32/29420_2.png) [@nickmuchi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnickmuchi)%5C
**Post date:** [February 2, 2022, 10:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F3 "2022-02-02T10:31:09Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [February 2, 2022, 3:39pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F4 "2022-02-02T15:39:49Z")

</div>

`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()`.

---

<div class="post-metadata">

**Author:** ![jibi2906](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jibi2906](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjibi2906)%5C
**Post date:** [January 9, 2023, 12:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F5 "2023-01-09T00:59:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HERIUN](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/heriun/32/53483_2.png) [@HERIUN](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHERIUN)%5C
**Post date:** [September 5, 2025, 5:30am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-training-args%2F5720%2F6 "2025-09-05T05:30:38Z")

</div>

```auto
import torch

args = torch.load("training_args.bin", weights_only=False)

```
