# Calling changed functions in transformers/training\_args

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcalling-changed-functions-in-transformers-training-args%2F8197%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 8, 2021, 10:44pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcalling-changed-functions-in-transformers-training-args%2F8197 "2021-07-08T22:44:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cxu-ml](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@cxu-ml](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcxu-ml)%5C
**Post date:** [July 8, 2021, 10:44pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcalling-changed-functions-in-transformers-training-args%2F8197%2F1 "2021-07-08T22:44:24Z")

</div>

I am maintaining a program that used to do things like  
`TrainingArguments.to_json_string(my_object)` and `TrainingArguments.to_sanitized_dict(my_object)`.

But in the latest version of [transformers/training\_args](https://huggingface.co/transformers/_modules/transformers/training_args.html) (v4.8.2), these two functions do not take arguments anymore. Instead, they act on ‘self’, which is a TrainingArgument object: `to_json_string(self)` and `to_sanitized_dict(self) -> Dict[str, Any]`.

Therefore, I wonder how do I change my implementation accordingly in order to make the same functionality works. Copying functions from transformers/training\_args to my object class solves part of the issue, but works bad when the function has dependencies on other things in transformers/training\_args, and it doesn’t make a lot of sense to copy everything from the transformers/training\_args file to my object class.

What is the best way of doing this? Thank you!

---

<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:** [July 9, 2021, 12:51am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcalling-changed-functions-in-transformers-training-args%2F8197%2F2 "2021-07-09T00:51:13Z")

</div>

Those functions have not changed since the 14 months ago, so quite a few versions. They have always been methods, which you should call directly on an instance of a `TrainingArguments`.
