Train your first Decision Transformer

📰 Hugging Face Blog

Train a Decision Transformer model from scratch to make a half-cheetah run using the transformers library

intermediate Published 8 Sept 2022
Action Steps
  1. Load the dataset and build a Custom Data Collator
  2. Train the Decision Transformer model using a transformers Trainer
  3. Fine-tune the model for a specific task, such as making a half-cheetah run
Who Needs to Know This

Machine learning engineers and AI researchers can benefit from this tutorial to learn how to train Decision Transformer models for offline decision-making tasks

Key Insight

💡 Decision Transformers can be used as decision-making models, and can be trained from scratch using the transformers library

Share This
🤖 Train your first Decision Transformer model to make a half-cheetah run! 💻

Key Takeaways

Train a Decision Transformer model from scratch to make a half-cheetah run using the transformers library

Full Article

Published Time: 2022-09-08T00:00:00.124Z

# Train your first Decision Transformer

[![Image 1: Hugging Face's logo](https://huggingface.co/front/assets/huggingface_logo-noborder.svg)Hugging Face](https://huggingface.co/)

* [Models](https://huggingface.co/models)
* [Datasets](https://huggingface.co/datasets)
* [Spaces](https://huggingface.co/spaces)
* [Buckets new](https://huggingface.co/storage)
* [Docs](https://huggingface.co/docs)
* [Enterprise](https://huggingface.co/enterprise)
* [Pricing](https://huggingface.co/pricing)
*
*
* * *

* [Log In](https://huggingface.co/login)
* [Sign Up](https://huggingface.co/join)

[Back to Articles](https://huggingface.co/blog)

# [](https://huggingface.co/blog/train-decision-transformers#train-your-first-decision-transformer) Train your first Decision Transformer

Published September 8, 2022

[Update on GitHub](https://github.com/huggingface/blog/blob/main/train-decision-transformers.md)

[- [x] Upvote 15](https://huggingface.co/login?next=%2Fblog%2Ftrain-decision-transformers)
* [![Image 2](https://huggingface.co/avatars/84ce9f3061d10f4326820596ae57ac4c.svg)](https://huggingface.co/jufan "jufan")
* [![Image 3](https://cdn-avatars.huggingface.co/v1/production/uploads/6343314d07fa6ff0c224eac3/2SmoBIaWTMui8phWB4Di5.jpeg)](https://huggingface.co/NeoCodes-dev "NeoCodes-dev")
* [![Image 4](https://huggingface.co/avatars/5d6c0528e520a4a0a69e91422b344d89.svg)](https://huggingface.co/almonmanzano "almonmanzano")
* [![Image 5](https://huggingface.co/avatars/c8cc724dc19f3145a8a13ece6ed4bdd0.svg)](https://huggingface.co/cpgrant "cpgrant")
* [![Image 6](https://huggingface.co/avatars/d8b71598618cdd73cda40b0ecd8caeaf.svg)](https://huggingface.co/neeldevenshah "neeldevenshah")
* [![Image 7](https://cdn-avatars.huggingface.co/v1/production/uploads/64d9c27f3be3c579590a13a8/JW-DmDUPcXLK1J3UO3LNc.png)](https://huggingface.co/mkk20 "mkk20")
* +9

[![Image 8: Edward Beeching's avatar](https://cdn-avatars.huggingface.co/v1/production/uploads/1644220542819-noauth.jpeg)](https://huggingface.co/edbeeching)

[Edward Beeching edbeeching Follow](https://huggingface.co/edbeeching)

[![Image 9: Thomas Simonini's avatar](https://cdn-avatars.huggingface.co/v1/production/uploads/1632748593235-60cae820b1c79a3e4b436664.jpeg)](https://huggingface.co/ThomasSimonini)

[Thomas Simonini ThomasSimonini Follow](https://huggingface.co/ThomasSimonini)

* [What are Decision Transformers?](https://huggingface.co/blog/train-decision-transformers#what-are-decision-transformers "What are Decision Transformers?")

* [Training Decision Transformers](https://huggingface.co/blog/train-decision-transformers#training-decision-transformers "Training Decision Transformers")
* [Loading the dataset and building the Custom Data Collator](https://huggingface.co/blog/train-decision-transformers#loading-the-dataset-and-building-the-custom-data-collator "Loading the dataset and building the Custom Data Collator")

* [Training the Decision Transformer model with a 🤗 transformers Trainer.](https://huggingface.co/blog/train-decision-transformers#training-the-decision-transformer-model-with-a-%F0%9F%A4%97-transformers-trainer "Training the Decision Transformer model with a 🤗 transformers Trainer.")

* [Conclusion](https://huggingface.co/blog/train-decision-transformers#conclusion "Conclusion")

* [What’s next?](https://huggingface.co/blog/train-decision-transformers#whats-next "What’s next?")

* [References](https://huggingface.co/blog/train-decision-transformers#references "References")

In a [previous post](https://huggingface.co/blog/decision-transformers), we announced the launch of Decision Transformers in the transformers library. This new technique of **using a Transformer as a Decision-making model** is getting increasingly popular.
So today, **you’ll learn to train your first Offline Decision Transformer model from scratch to make a half-cheetah run.** We'll train it directly on a Go
Read full article → ← Back to Reads

Related Videos

5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
ChatGPT vs Claude: Which One Should Beginners Actually Use?
ChatGPT vs Claude: Which One Should Beginners Actually Use?
PlivoAI
How to Move Your ChatGPT Brain to Claude!
How to Move Your ChatGPT Brain to Claude!
PlivoAI
How I Use Claude To Create Blogs That Make Money (Step by Step Guide)
How I Use Claude To Create Blogs That Make Money (Step by Step Guide)
Brendan Gillen
The End of Unlimited AI!
The End of Unlimited AI!
PlivoAI
Chapter 3: Looking Inside Large Language Models | Hands-On Large Language Models Book
Chapter 3: Looking Inside Large Language Models | Hands-On Large Language Models Book
onepagecode