In this video, we will see how to use a custom loss function. Most 🤗 Transformers models automatically return the loss when you provide them with labels, but sometimes, you don't want the default loss. Here we show how to dynamically weight samples in the loss using the Trainer API and 🤗 Accelerate.
This video is part of the Hugging Face course: http://huggingface.co/course
Open in colab to run the code samples:
https://colab.research.google.com/git...
Related videos:
The Trainer API: • The Trainer API
Write your training loop in PyTorch: • Write your training loop in PyTorch
Supercharge your PyTorch training loop with Accelerate: • Supercharge your PyTorch training loop wit...
Don't have a Hugging Face account? Join now: http://huggingface.co/join
Have a question? Checkout the forums: https://discuss.huggingface.co/c/cour...
Subscribe to our newsletter: https://huggingface.curated.co/