Skip to content

Conversation

@sergiopaniego
Copy link
Member

What does this PR do?

Fine tune a 14B model on free Colab using TRL+SFT!
It already uses this PR so its dependent on it

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@qgallouedec @kashif

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

}
],
"source": [
"prompt = hf_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use llm.chat directly here

"import torch\n",
"\n",
"llm = LLM(\n",
" model=f\"sergiopaniego/{output_dir}-merged\", # Replace with your HF username or organization\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to do it right now but in the future it could be nice to centralize every artifact in hf.co/trl-lib

@qgallouedec
Copy link
Member

For some reason the new trackio space doesn't render (the previous one does)

Screenshot 2025-10-24 at 11 53 21 AM

" **model_inputs,\n",
" max_new_tokens=512\n",
")\n",
"output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: tolist no needed

Suggested change
"output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()\n",
"output_ids = generated_ids[0][len(model_inputs.input_ids[0]):]\n",

@sergiopaniego
Copy link
Member Author

Updated based on comments! Ready for final review/merge

For some reason the new trackio space doesn't render (the previous one does)

Screenshot 2025-10-24 at 11 53 21 AM

I've tested it downloading the updated notebook from here and it shows the Space when opening it from Colab or VS Code. Maybe the Space was on sleeping state at that point.

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super cool notebook, merging now, sorry for late review

@qgallouedec qgallouedec merged commit f683420 into main Oct 31, 2025
3 checks passed
@qgallouedec qgallouedec deleted the sft_qlora_notebook branch October 31, 2025 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants