Text Generation
Transformers
Safetensors
qwen3
quantization
qlora
w4a16
mcqa
cs552
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use abdou-u/MNLP_M3_quantized_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abdou-u/MNLP_M3_quantized_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="abdou-u/MNLP_M3_quantized_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("abdou-u/MNLP_M3_quantized_model") model = AutoModelForCausalLM.from_pretrained("abdou-u/MNLP_M3_quantized_model", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use abdou-u/MNLP_M3_quantized_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "abdou-u/MNLP_M3_quantized_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdou-u/MNLP_M3_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/abdou-u/MNLP_M3_quantized_model
- SGLang
How to use abdou-u/MNLP_M3_quantized_model 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 "abdou-u/MNLP_M3_quantized_model" \ --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": "abdou-u/MNLP_M3_quantized_model", "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 "abdou-u/MNLP_M3_quantized_model" \ --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": "abdou-u/MNLP_M3_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use abdou-u/MNLP_M3_quantized_model with Docker Model Runner:
docker model run hf.co/abdou-u/MNLP_M3_quantized_model
| library_name: transformers | |
| tags: | |
| - quantization | |
| - qlora | |
| - w4a16 | |
| - mcqa | |
| - cs552 | |
| # Model Card for `abdou-u/MNLP_M3_quantized_model` | |
| This model is a quantized version of the MCQA model trained on multiple-choice question answering tasks. It uses **QLoRA** with **W4A16** (4-bit weights, 16-bit activations) to minimize memory usage while maintaining high accuracy. The model is fine-tuned on a carefully selected stabilization subset from the MCQA dataset. | |
| ## Model Details | |
| ### Model Description | |
| - **Developed by:** Ahmed Abdelmalek (EPFL CS-552 Project) | |
| - **Model type:** Causal Language Model (Transformer-based) | |
| - **Language(s):** English | |
| - **License:** Apache 2.0 (inherited from base models) | |
| - **Fine-tuned from:** `mgatti/MNLP_M3_mcqa_model` | |
| - **Quantization:** QLoRA (W4A16), using 4-bit NF4 weights and bfloat16 activations with LoRA adapters merged post-training. | |
| ### Model Sources | |
| - **Repository:** Private GitHub repository (training code) | |
| - **Model Hub:** [abdou-u/MNLP_M3_quantized_model](https://huggingface.co/abdou-u/MNLP_M3_quantized_model) | |
| ## Uses | |
| ### Direct Use | |
| This model can be used for inference on multiple-choice question answering tasks, especially when deploying in resource-constrained environments (e.g., A100, T4, or consumer GPUs). | |
| ### Out-of-Scope Use | |
| - Not intended for open-ended generation. | |
| - Not suitable for dialogue applications. | |
| ## Bias, Risks, and Limitations | |
| - Biases may be present from the original datasets. | |
| - Not suitable for real-world high-stakes decision making. | |
| ## How to Get Started | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("abdou-u/MNLP_M3_quantized_model") | |
| tokenizer = AutoTokenizer.from_pretrained("abdou-u/MNLP_M3_quantized_model") | |
| ``` | |
| ## Training Details | |
| ### Training Data | |
| The model was fine-tuned on a 15% stabilization subset that is `abdou-u/MNLP_M3_quantized_dataset`, a harmonized MCQA-style dataset consisting of curated subsets from MMLU, AQuA, and TheoremQA. | |
| ### Training Procedure | |
| - Quantized with QLoRA W4A16 (NF4 weights, bfloat16 activations) | |
| - Trained for 1 epoch | |
| - Batch size: 8 (with gradient accumulation = 4) | |
| - LoRA adapters merged post-training | |
| #### Hyperparameters | |
| - `learning_rate = 2e-5` | |
| - `num_train_epochs = 1` | |
| - `fp16 = True` | |
| - `lora_alpha = 32` | |
| - `r = 16` | |
| - `lora_dropout = 0.05` | |
| ## Evaluation | |
| - Fine-tuned model evaluated on internal stabilization subset using accuracy and F1 score (details in final report). | |
| ## Environmental Impact | |
| - **Hardware Type:** A100 (80GB) | |
| - **Training Duration:** ~20 minutes | |
| - **Compute Region:** Europe (EPFL cluster) | |
| - **Estimated CO₂ emissions:** < 0.1 kg | |
| ## Technical Specifications | |
| - Framework: PyTorch (Transformers, PEFT) | |
| - Quantization: BitsAndBytes (4-bit NF4), merged LoRA adapters | |
| ## Citation | |
| **APA:** | |
| Ahmed Abdelmalek. (2025). *MNLP_M3_quantized_model (QLoRA W4A16 MCQA)*. Hugging Face. | |
| ## Model Card Contact | |
| - Ahmed Abdelmalek — [ahmed.abdelmalek@epfl.ch] | |