torchtune icon indicating copy to clipboard operation
torchtune copied to clipboard

[RFC][Docs][WIP] Custom Recipe Tutorial

Open SalmanMohammadi opened this issue 7 months ago • 5 comments

Context

What is the purpose of this PR? Is it to

  • [ ] add a new feature
  • [ ] fix a bug
  • [X] update tests and/or documentation
  • [ ] other (please add here)

This tutorial will follow along as I (henceforth referred to as "The Author"), The Author, implements a simple recipe (henceforth referred to as "The Tutorial") for the express purpose of educating and enlightening the user (henceforth known as "The Reader"), in the implementation and optimization of language model training code. The Reader, upon accessing and engaging with The Tutorial contained therein, shall be privy to the methodologies, best practices, and advanced optimization techniques as demonstrated by The Author.

Okay, enough nonesense. I briefly mentioned this offline (online?) to @kartikayk and @joecummings. Torchtune's design philosophy makes things hackable, easy-to-understand, and extend. I'd like to surface how straightforward this can make adding custom fine-tuning recipes for our more intermediate users. Readers will get to see the process for how to get started with a new recipe, and generally lots of tips and tricks for writing training code for LLMs. I'd also like to showcase the awesome optimisation features we expose, which I'll demonstrate in the recipe by providing readers some insight into e.g. what torch.compile can practically do for them here, without necessarily needing to understand the internals.

Initially I'm thinking of killing two birds with one stone here and documenting my process for adding a (very simple) reward model finetuning recipe which I can later extend and contribute.

As you can see, this is a very rough overview of my vision here, just opening this up early to make sure we're aligned and to field any ideas or input.

EDIT: interest from #1249

Test plan

👀 👀 👁️ 👁️

Perhaps someone could guinea pig and try follow along the final tutorial?

SalmanMohammadi avatar Jul 18 '24 09:07 SalmanMohammadi