Skip to content

[QEff.Finetuning] Added support for SFTTrainer class along with tests#660

Closed
quic-dhirajku wants to merge 60 commits intoquic:ft_experimentalfrom
quic-dhirajku:ft_exp
Closed

[QEff.Finetuning] Added support for SFTTrainer class along with tests#660
quic-dhirajku wants to merge 60 commits intoquic:ft_experimentalfrom
quic-dhirajku:ft_exp

Conversation

@quic-dhirajku
Copy link
Contributor

No description provided.

Copy link
Contributor

@quic-meetkuma quic-meetkuma left a comment

Choose a reason for hiding this comment

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

I feel some redundant tests can be moved to test_model.py. Rest looks fine.

@quic-swatia
Copy link
Contributor

PEFT config should be added here in the BaseTrainer class as it is part of training config. trl repo has also added it in the trainer classes. We should not deviate from that. It will make the code reuse difficult at a later stage. Please refer: https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py

Please keep the flexibility to accept PEFT techniques/configuration of various kinds and not just LoRA.

@quic-swatia quic-swatia self-requested a review December 24, 2025 12:31
Copy link
Contributor

@quic-meetkuma quic-meetkuma left a comment

Choose a reason for hiding this comment

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

Minor comments. Tests look fine and covers most cases. Just check if any validation related tests are missing. E.g. validation of params being done at SFTTrainer or Trainer level implementation which should be added as a test case here. I mean important argument's validation only. There will be extensive validation happening at their side of code but we are bothered about only important params which we are concerned about.

Copy link
Contributor

@quic-akuruvil quic-akuruvil left a comment

Choose a reason for hiding this comment

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

LGTM, please rebase against main, so that ft_experimental branch is aligned with current main.

mohiso22 and others added 14 commits January 2, 2026 11:54
Signed-off-by: Mohit Soni <mohisoni@qti.qualcomm.com>
Co-authored-by: Hem Agnihotri <hemagnih@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Fixed -10000 with MIN_MASK

Signed-off-by: Dipankar Sarkar <quic_dipankar@quicinc.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Updated the correct code with updated syntax, removed device_group
parameter in model.compile()

Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Mohit Soni <mohisoni@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
…c#553)

### 📢 Expanded On-Device Sampling Support in QEfficient

Excited to share that **On-Device Sampling**—previously available only
for `LlamaForCausalLM`—is now supported across a broader set of
architectures! This enhancement brings faster, more efficient inference
directly to the QAIC device.

#### ✅ Newly Supported Architectures:
1. `FalconForCausalLM`
2. `GemmaForCausalLM`
3. `GPT2LMHeadModel`
4. `GPTJForCausalLM`
5. `GraniteForCausalLM`
6. `GraniteMoeForCausalLM`
7. `LlamaForCausalLM` (existing)
8. `MptForCausalLM`
9. `Phi3ForCausalLM`
10. `Qwen2ForCausalLM`

#### ⚠️ Architectures Still Pending Support:
1. `GPTBigCodeForCausalLM`
2. `InternVLChatModel`
3. `MistralForCausalLM`
4. `MixtralForCausalLM`
5. `LlamaSwiftKVForCausalLM`
6. `Grok1ModelForCausalLM`

We’re actively working to extend support to these models. Contributions,
feedback, and testing from the community are always welcome to help
accelerate this effort!

---------

Signed-off-by: quic-sanising <quic_sanising@quicinc.com>
Signed-off-by: sanising <sanising@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Co-authored-by: sanising <sanising@qti.qualcomm.com>
Co-authored-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Co-authored-by: Hem Agnihotri <hemagnih@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
…uic#599)

Signed-off-by: meetkuma <meetkuma@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Mamta Singh <mamtsing@qti.qualcomm.com>
Signed-off-by: Rishin Raj <rishinr@qti.qualcomm.com>
Signed-off-by: Asmita Goswami <asmigosw@qti.qualcomm.com>
Signed-off-by: Mohit Soni <mohisoni@qti.qualcomm.com>
Signed-off-by: vbaddi <quic_vbaddi@quicinc.com>
Co-authored-by: Mamta Singh <mamtsing@qti.qualcomm.com>
Co-authored-by: Asmita Goswami <asmigosw@qti.qualcomm.com>
Co-authored-by: Rishin Raj <rishinr@qti.qualcomm.com>
Co-authored-by: Mohit Soni <mohisoni@qti.qualcomm.com>
Co-authored-by: Vinayak Baddi <vbaddi@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Mohit Soni <mohisoni@qti.qualcom.com>
Co-authored-by: Mohit Soni <mohisoni@qti.qualcom.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: vbaddi <quic_vbaddi@quicinc.com>
Signed-off-by: Onkar Chougule <ochougul@qti.qualcomm.com>
Signed-off-by: Mamta Singh <mamtsing@qti.qualcomm.com>
Signed-off-by: Mamta Singh <168400541+quic-mamta@users.noreply.github.com>
Co-authored-by: Vinayak Baddi <quic_vbaddi@quicinc.com>
Co-authored-by: Vinayak Baddi <vbaddi@qti.qualcomm.com>
Co-authored-by: Mamta Singh <mamtsing@qti.qualcomm.com>
Co-authored-by: Mamta Singh <168400541+quic-mamta@users.noreply.github.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
…s Page (quic#588)

Signed-off-by: Varun Gupta <vargupt@qti.qualcomm.com>
Co-authored-by: Abhishek Kumar Singh <sabhis@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Tanisha <tchawada@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
…c#614)

Signed-off-by: Tanisha <tchawada@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
This pull request is created for updating the _onnx opset_ version to 17
from 13.

## Testing
Below are the models I have tested:
### Causal Models
- TinyLlama/TinyLlama-1.1B-Chat-v1.0
- gpt2
- Salesforce/codegen-350M-mono
- microsoft/Phi-3-mini-4k-instruct
- tiiuae/falcon-7b
- Qwen/Qwen2-0.5B
- Qwen/Qwen3-0.6B
- bigcode/starcoder2-3b
- Qwen/Qwen3-30B-A3B-Instruct-2507
- Felladrin/Minueza-32M-Base
- wtang06/mpt-125m-c4
- hakurei/gpt-j-random-tinier
- mistralai/Mixtral-8x7B-Instruct-v0.1
- meta-llama/Llama-3.2-1B
- unsloth/gemma-2b
- unsloth/gemma-2-2b
- TheBloke/TinyLlama-1.1B-Chat-v0.3-AWQ
- TheBloke/Llama-2-7B-GPTQ
- ibm-granite/granite-20b-code-base
- neuralmagic/Llama-3.2-3B-Instruct-FP8
- neuralmagic/Qwen2-0.5B-Instruct-FP8
- ibm-granite/granite-3.1-2b-instruct
- ibm-granite/granite-guardian-3.1-2b
- hpcai-tech/grok-1
- Snowflake/Llama-3.1-SwiftKV-8B-Instruct
- allenai/OLMo-2-0425-1B

### Embedding Models
- BAAI/bge-base-en-v1.5
- BAAI/bge-large-en-v1.5
- BAAI/bge-small-en-v1.5
- intfloat/e5-large-v2
- sentence-transformers/multi-qa-mpnet-base-cos-v1
- ibm-granite/granite-embedding-30m-english
- ibm-granite/granite-embedding-125m-english
- BAAI/bge-reranker-v2-m3
- ibm-granite/granite-embedding-107m-multilingual
- ibm-granite/granite-embedding-278m-multilingual

### Vision Models
- llava-hf/llava-1.5-7b-hf
- OpenGVLab/InternVL2_5-1B
- meta-llama/Llama-3.2-11B-Vision-Instruct
- ibm-granite/granite-vision-3.2-2b
- meta-llama/Llama-4-Scout-17B-16E-Instruct
- google/gemma-3-4b-it

### Audio Models
- openai/whisper-tiny
- openai/whisper-base
- openai/whisper-small
- openai/whisper-medium
- openai/whisper-large
- openai/whisper-large-v3-turbo

---------

Signed-off-by: Abukhoyer Shaik <abukhoye@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Abukhoyer Shaik <abukhoye@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Onkar Chougule <ochougul@qti.qualcomm.com>
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
@quic-dhirajku
Copy link
Contributor Author

PEFT config should be added here in the BaseTrainer class as it is part of training config. trl repo has also added it in the trainer classes. We should not deviate from that. It will make the code reuse difficult at a later stage. Please refer: https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py

Please keep the flexibility to accept PEFT techniques/configuration of various kinds and not just LoRA.

It has been addressed in the latest commit.

quic-dhirajku added a commit to quic-dhirajku/efficient-transformers that referenced this pull request Jan 2, 2026
Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
@quic-dhirajku
Copy link
Contributor Author

Created Pr #697 with all the changes done in this PR, along with all the comments being addressed as well. Closing this PR due to the rebase issue.

quic-dhirajku added a commit that referenced this pull request Jan 2, 2026
This PR contains all the changes of PR #660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Jan 16, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 4, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 4, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 4, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 4, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 5, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
tchawada pushed a commit to tchawada/QEff_tanisha that referenced this pull request Feb 5, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
quic-swatia pushed a commit to quic-swatia/efficient-transformers that referenced this pull request Feb 9, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
quic-akuruvil pushed a commit to quic-akuruvil/efficient_transformers that referenced this pull request Feb 9, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
quic-akuruvil pushed a commit to quic-akuruvil/efficient_transformers that referenced this pull request Feb 16, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
quic-swatia pushed a commit to quic-swatia/efficient-transformers that referenced this pull request Feb 26, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 6, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 6, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 6, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 8, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 8, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>

Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 8, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
Signed-off-by: Sharvari Medhe <smedhe@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 9, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 10, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 17, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
smedhe pushed a commit to smedhe/QEff_Sharvari that referenced this pull request Mar 18, 2026
This PR contains all the changes of PR quic#660 along with all the comments
being addressed. The new PR was created due a rebase issue.

Signed-off-by: Dhiraj Kumar Sah <dhirajku@qti.qualcomm.com>
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.