Text Generation
Transformers
Safetensors
qwen3
quantization
bitsandbytes
4-bit precision
nf4
double-quant
mcqa
conversational
Instructions to use Kikinoking/MNLP_M3_quantized_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kikinoking/MNLP_M3_quantized_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kikinoking/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("Kikinoking/MNLP_M3_quantized_model") model = AutoModelForCausalLM.from_pretrained("Kikinoking/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 Kikinoking/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 "Kikinoking/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": "Kikinoking/MNLP_M3_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kikinoking/MNLP_M3_quantized_model
- SGLang
How to use Kikinoking/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 "Kikinoking/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": "Kikinoking/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 "Kikinoking/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": "Kikinoking/MNLP_M3_quantized_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kikinoking/MNLP_M3_quantized_model with Docker Model Runner:
docker model run hf.co/Kikinoking/MNLP_M3_quantized_model
| library_name: transformers | |
| tags: | |
| - quantization | |
| - bitsandbytes | |
| - 4-bit | |
| - nf4 | |
| - double-quant | |
| - mcqa | |
| # Model Card for `Kikinoking/MNLP_M3_quantized_model` | |
| A 4-bit double-quantized (NF4 + nested quant) version of the MNLP_M3_mcqa_model, compressed with bitsandbytes. This model answers multiple-choice questions (MCQA) with minimal GPU memory usage. | |
| ## Model Details | |
| - **Model ID:** `Kikinoking/MNLP_M3_quantized_model` | |
| - **Quantization:** 4-bit NF4 + nested quantization (`bnb_4bit_use_double_quant=True`) | |
| - **Base model:** `aidasvenc/MNLP_M3_mcqa_model` | |
| - **Library:** Transformers + bitsandbytes | |
| - **Task:** Multiple-choice question answering (MCQA) | |
| ## Usage | |
| Load and run inference in just a few lines: | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| model_id = "Kikinoking/MNLP_M3_quantized_model" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| device_map="auto", | |
| torch_dtype="auto", | |
| low_cpu_mem_usage=True | |
| ).eval() | |
| prompt = "What is the capital of France ?\nA) Lyon B) Marseille C) Paris D) Toulouse\nAnswer: " | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| with torch.inference_mode(): | |
| output = model.generate(**inputs, max_new_tokens=1) | |
| print("Answer:", tokenizer.decode(output[0], skip_special_tokens=True)) | |
| ##How It Was Built | |
| from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig | |
| import torch | |
| base_id = "aidasvenc/MNLP_M3_mcqa_model" | |
| qcfg = BitsAndBytesConfig( | |
| load_in_4bit=True, | |
| bnb_4bit_quant_type="nf4", | |
| bnb_4bit_compute_dtype=torch.bfloat16, | |
| bnb_4bit_use_double_quant=True | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(base_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| base_id, | |
| quantization_config=qcfg, | |
| device_map="auto", | |
| torch_dtype="auto" | |
| ) | |
| # Push to Hugging Face Hub | |
| model.push_to_hub("Kikinoking/MNLP_M3_quantized_model", private=True) | |
| tokenizer.push_to_hub("Kikinoking/MNLP_M3_quantized_model") | |
| print("VRAM used (MiB):", torch.cuda.memory_reserved()/1024**2) | |