[docs] Add integration test example to copy pasta template (#5961)

Co-authored-by: Julien Chaumond <chaumond@gmail.com>
This commit is contained in:
Sam Shleifer
2020-07-22 12:48:38 -04:00
committed by GitHub
parent 01116d3c5b
commit feeb956a19
8 changed files with 287 additions and 222 deletions

View File

@@ -1,5 +1,15 @@
# 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.
Add tests!
Currently only examples for PyTorch are provided which are adaptations of the library's SQuAD examples which implement single-GPU and distributed training with gradient accumulation and mixed-precision (using NVIDIA's apex library) to cover a reasonable range of use cases.
These folder can be put in a subdirectory under your example's name, like `examples/deebert`.
Best Practices:
- use `Trainer`/`TFTrainer`
- write an @slow test that checks that your model can train on one batch and get a low loss.
- this test should use cuda if it's available. (e.g. by checking `transformers.torch_device`)
- adding an `eval_xxx.py` script that can evaluate a pretrained checkpoint.
- tweet about your new example with a carbon screenshot of how to run it and tag @huggingface