transformers/templates/adding_a_new_example_script
Matt 9be4728af8
Just import torch AdamW instead (#36177)
* Just import torch AdamW instead

* Update docs too

* Make AdamW undocumented

* make fixup

* Add a basic wrapper class

* Add it back to the docs

* Just remove AdamW entirely

* Remove some AdamW references

* Drop AdamW from the public init

* make fix-copies

* Cleanup some references

* make fixup

* Delete lots of transformers.AdamW references

* Remove extra references to adamw_hf
2025-03-19 18:29:40 +00:00
..
{{cookiecutter.directory_name}} Just import torch AdamW instead (#36177) 2025-03-19 18:29:40 +00:00
cookiecutter.json Update the example template for a no Trainer option (#10865) 2021-03-23 10:02:39 -04:00
README.md [Docs] Add language identifiers to fenced code blocks (#28955) 2024-02-12 10:48:31 -08:00

How to add a new example script in 🤗 Transformers

This folder provide a template for adding a new example script implementing a training or inference task with the models in the 🤗 Transformers library. To use it, you will need to install cookiecutter:

pip install cookiecutter

or refer to the installation page of the cookiecutter documentation.

You can then run the following command inside the examples folder of the transformers repo:

cookiecutter ../templates/adding_a_new_example_script/

and answer the questions asked, which will generate a new folder where you will find a pre-filled template for your example following the best practices we recommend for them.

Adjust the way the data is preprocessed, the model is loaded or the Trainer is instantiated then when you're happy, add a README.md in the folder (or complete the existing one if you added a script to an existing folder) telling a user how to run your script.

Make a PR to the 🤗 Transformers repo. Don't forget to tweet about your new example with a carbon screenshot of how to run it and tag @huggingface!