Instructions to use Syed-Hasan-8503/Mistral_classification_head_qlora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Syed-Hasan-8503/Mistral_classification_head_qlora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Syed-Hasan-8503/Mistral_classification_head_qlora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Syed-Hasan-8503/Mistral_classification_head_qlora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Syed-Hasan-8503/Mistral_classification_head_qlora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Syed-Hasan-8503/Mistral_classification_head_qlora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Syed-Hasan-8503/Mistral_classification_head_qlora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Syed-Hasan-8503/Mistral_classification_head_qlora
- SGLang
How to use Syed-Hasan-8503/Mistral_classification_head_qlora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Syed-Hasan-8503/Mistral_classification_head_qlora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Syed-Hasan-8503/Mistral_classification_head_qlora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Syed-Hasan-8503/Mistral_classification_head_qlora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Syed-Hasan-8503/Mistral_classification_head_qlora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Syed-Hasan-8503/Mistral_classification_head_qlora with Docker Model Runner:
docker model run hf.co/Syed-Hasan-8503/Mistral_classification_head_qlora
Mistral_classification_head_qlora
Mistral_classification_head_qlora has a new transformer head attached to it for sequence classification task and then resulting model has been finetuned on dair-ai/emotion dataset using QloRA. The model has been trained for 1 epoch on 1x A40 GPU. The evaluation loss for the emotion-head-3 attached to it was 1.313. The base model used was
This experiment was performed using Transformer-heads library
Training Script
The training script for attaching a new transformer head for classification task using QLoRA is following:
Evaluating the Emotion-Head-3
For evaluating the transformer head that has been attached to the base model, you can refer to the following colab notebook Colab Notebook for Evaluation
Training hyperparameters
The following hyperparameters were used during training:
train_epochs = 1 eval_epochs = 1 logging_steps = 1 train_batch_size = 4 eval_batch_size = 4
- output_dir="emotion_linear_probe",
- learning_rate=0.00002,
- num_train_epochs=train_epochs,
- logging_steps=logging_steps,
- do_eval=False,
- remove_unused_columns=False,
- optim="paged_adamw_32bit",
- gradient_checkpointing=True,
- lr_scheduler_type="constant",
- ddp_find_unused_parameters=False,
- per_device_train_batch_size=train_batch_size,
- per_device_eval_batch_size=eval_batch_size,
- report_to=["wandb"]
Framework versions
- Transformers 4.39.0.dev0
- Pytorch 2.1.2+cu118
- Datasets 2.17.0
- Tokenizers 0.15.0
- Transfomer-heads
Model tree for Syed-Hasan-8503/Mistral_classification_head_qlora
Base model
mistralai/Mistral-7B-Instruct-v0.2