tiny Qwen2ForSequenceClassification 2.5
Overview
The tiny Qwen2ForSequenceClassification 2.5 is a lightweight, encoder-style adaptation of the Qwen2 architecture specifically optimized for text classification tasks. Designed for developers who need low-latency inference and a small memory footprint, this model excels at sentiment analysis, intent detection, and document tagging without the overhead of a full generative LLM. It integrates seamlessly into standard Hugging Face pipelines, making it an efficient choice for edge deployment or as a first-stage filter in complex RAG pipelines. Compared to larger classification models, it offers a competitive balance of accuracy and speed, providing a scalable alternative for high-throughput production environments where millisecond response times are critical.
Highlights
- Optimized for low-latency text classification and intent detection
- Small memory footprint ideal for edge device deployment
- Seamless integration with Hugging Face Transformers library
- Apache-2.0 license ensures flexible commercial production use
- Efficient alternative to larger generative models for labeling
Usage
Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5")
tokenizer = AutoTokenizer.from_pretrained("trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5")
Hugging Face Download
We recommend downloading the model via the Hugging Face CLI or Hub SDK.
Guidance:Before downloading, install huggingface_hub with:
Guidance
pip install -U huggingface_hub
CLI Download
Download the full repository
Download the full repository
huggingface-cli download trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5
Download a single file to a local folder (e.g. config.json into ./dir)
Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5 config.json --local-dir ./dir
See the official docs for more CLI options
SDK Download
SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5')
Git Download
Make sure git-lfs is installed first
Git Download
git lfs install
git clone https://huggingface.co/trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5
To skip LFS large-file downloads, use:
Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5
Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.
PyTorch / Transformers Usage
Install Transformers
Install Transformers
pip install -U transformers torch
Load the model and run inference
Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5')
tokenizer = AutoTokenizer.from_pretrained('trl-internal-testing/tiny-Qwen2ForSequenceClassification-2.5')
Full Documentation
来源: HuggingFace
---
library_name: transformers
tags:
- trl
---
Tiny Qwen2ForSequenceClassification
This is a minimal model built for unit tests in the TRL library.