You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SFT tuning with Unsloth ingoring input tokens #150
Hey, I'm using Unsloth with 48Gb cards where it able to PRE-train models up to 70B with 4K context.
Is it possible to use Unsloth to do SFT with instructions on which tokens should be ignored / masked, and attention matrix for properly packing samples?
Please help with some examples if it possible. Have to use Axolotl for SFT tasks now.
@gotzmann Cool thanks for the info! Redditors also mentioned on an example of ShareGPT style conversations - I'll see what I can do to make a Colab notebook :)
@gotzmann Yes but it partially solves ur first issue of using a ShareGPT style format - I think train only on inputs isnt done in that notebook. It will require some more custom codepaths.
For packing - again this is a feature request, so depending on how much bandwidth we have, I'll see what we can do.
Hey @gotzmann , we just released new Unsloth kernels and automatic uncontaminated packing!! It's enabled by default smartly and will make training 3x faster + use much less VRAM like 30% or more.
Activity
danielhanchen commentedon Feb 3, 2024
@gotzmann I think you're referring to 2 things:
train_completionsandpacking=True#109 and [Feature Request] 10x faster training: Decontaminated Sample Packing #126gotzmann commentedon Feb 3, 2024
I'm using Unsloth not initializing any collators explicitly within my code. So basically trainer just process raw texts without any prompts and masks:
What I'd like to understand:
How to use Unsloth with system prompting, adding some more information to implement
train_on_inputs = falsefeatureHow to pack aftermentioned examples with prompting - to maximize performance
I'll try to grok thru mentioned links, but those looks too complicated for me :)
danielhanchen commentedon Feb 3, 2024
@gotzmann Would it be possible if you could show an approx few rows of your dataset, and what the required output would be?
gotzmann commentedon Feb 3, 2024
I'm evaluating different open datasets, converting all of them to ShareGPT format for easy of use.
Like this one, where
conversationscolumn containssystem/human/gptparts of one input piece:https://huggingface.co/datasets/teknium/OpenHermes-2.5
Basically what I'd want to implement directly with Unsloth and HF Transformers should be similar like this black magic code from Axolotl:
https://github.com/OpenAccess-AI-Collective/axolotl/blob/main/src/axolotl/prompt_tokenizers.py
gotzmann commentedon Feb 3, 2024
There special token for masking inputs:
IGNORE_TOKEN_ID = -100danielhanchen commentedon Feb 4, 2024
@gotzmann Cool thanks for the info! Redditors also mentioned on an example of ShareGPT style conversations - I'll see what I can do to make a Colab notebook :)
danielhanchen commentedon Feb 4, 2024
@gotzmann https://www.reddit.com/r/LocalLLaMA/comments/1ail8jr/qlora_with_sharegpt_and_chatml_template_ready_to/ :) Looks like someone made a Unsloth example for ShareGPT style datasets just today!!
gotzmann commentedon Feb 6, 2024
@danielhanchen sorry, nothing particularly interesting there.
Packing = False and there no any juggling with attention / inputs matrixes
Been there, done that :) There will be trashy model as output
danielhanchen commentedon Feb 7, 2024
@gotzmann Yes but it partially solves ur first issue of using a ShareGPT style format - I think train only on inputs isnt done in that notebook. It will require some more custom codepaths.
For packing - again this is a feature request, so depending on how much bandwidth we have, I'll see what we can do.
danielhanchen commentedon Oct 9, 2024
Apologies doing some Github Issues spring cleaning - https://github.com/unslothai/unsloth/wiki#train-on-completions--responses-only-do-not-train-on-inputs should be helpful hopefully for ignoring tokens - uncontaminated packing not yet though
danielhanchen commentedon Oct 9, 2024
For now will close this - uncontaminated packing issue tracker here: #126
Bug fixes, latest TRL, GRPO (unslothai#150)
Bug fixes, latest TRL, GRPO (unslothai#150)
Bug fixes, latest TRL, GRPO (unslothai#150)
shimmyshimmer commentedon Dec 10, 2025
Hey @gotzmann , we just released new Unsloth kernels and automatic uncontaminated packing!! It's enabled by default smartly and will make training 3x faster + use much less VRAM like 30% or more.
Blog + info: https://docs.unsloth.ai/new/3x-faster-training-packing
And support our tweet if you'd like: https://x.com/UnslothAI/status/1998765021170696664 Thank you!! 🥰