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") 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
Update README.md
Browse files
README.md
CHANGED
|
@@ -45,3 +45,30 @@ with torch.inference_mode():
|
|
| 45 |
output = model.generate(**inputs, max_new_tokens=1)
|
| 46 |
|
| 47 |
print("Answer:", tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
output = model.generate(**inputs, max_new_tokens=1)
|
| 46 |
|
| 47 |
print("Answer:", tokenizer.decode(output[0], skip_special_tokens=True))
|
| 48 |
+
|
| 49 |
+
##How It Was Built
|
| 50 |
+
|
| 51 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
| 52 |
+
import torch
|
| 53 |
+
|
| 54 |
+
base_id = "aidasvenc/MNLP_M3_mcqa_model"
|
| 55 |
+
qcfg = BitsAndBytesConfig(
|
| 56 |
+
load_in_4bit=True,
|
| 57 |
+
bnb_4bit_quant_type="nf4",
|
| 58 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 59 |
+
bnb_4bit_use_double_quant=True
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
tokenizer = AutoTokenizer.from_pretrained(base_id)
|
| 63 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 64 |
+
base_id,
|
| 65 |
+
quantization_config=qcfg,
|
| 66 |
+
device_map="auto",
|
| 67 |
+
torch_dtype="auto"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
# Push to Hugging Face Hub
|
| 71 |
+
model.push_to_hub("Kikinoking/MNLP_M3_quantized_model", private=True)
|
| 72 |
+
tokenizer.push_to_hub("Kikinoking/MNLP_M3_quantized_model")
|
| 73 |
+
|
| 74 |
+
print("VRAM used (MiB):", torch.cuda.memory_reserved()/1024**2)
|