Instructions to use burtenshaw/Qwen3-30B-A3B-python-coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use burtenshaw/Qwen3-30B-A3B-python-coder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="burtenshaw/Qwen3-30B-A3B-python-coder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("burtenshaw/Qwen3-30B-A3B-python-coder") model = AutoModelForCausalLM.from_pretrained("burtenshaw/Qwen3-30B-A3B-python-coder") 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
- vLLM
How to use burtenshaw/Qwen3-30B-A3B-python-coder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "burtenshaw/Qwen3-30B-A3B-python-coder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "burtenshaw/Qwen3-30B-A3B-python-coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/burtenshaw/Qwen3-30B-A3B-python-coder
- SGLang
How to use burtenshaw/Qwen3-30B-A3B-python-coder 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 "burtenshaw/Qwen3-30B-A3B-python-coder" \ --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": "burtenshaw/Qwen3-30B-A3B-python-coder", "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 "burtenshaw/Qwen3-30B-A3B-python-coder" \ --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": "burtenshaw/Qwen3-30B-A3B-python-coder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use burtenshaw/Qwen3-30B-A3B-python-coder with Docker Model Runner:
docker model run hf.co/burtenshaw/Qwen3-30B-A3B-python-coder
Upload train.py with huggingface_hub
Browse files
train.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
| 11 |
# "trl",
|
| 12 |
# "peft",
|
| 13 |
# "wandb",
|
| 14 |
-
# "bitsandbytes",
|
| 15 |
# "torchvision",
|
| 16 |
# "torchaudio",
|
| 17 |
# ]
|
|
@@ -22,7 +21,7 @@
|
|
| 22 |
|
| 23 |
import torch
|
| 24 |
from datasets import load_dataset
|
| 25 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 26 |
from trl import SFTConfig, SFTTrainer, setup_chat_format
|
| 27 |
from peft import LoraConfig
|
| 28 |
|
|
@@ -70,20 +69,12 @@ learning_rate = 2e-4
|
|
| 70 |
|
| 71 |
"""## Load model and tokenizer"""
|
| 72 |
|
| 73 |
-
# specify how to quantize the model
|
| 74 |
-
# quantization_config = BitsAndBytesConfig(
|
| 75 |
-
# load_in_4bit=True,
|
| 76 |
-
# bnb_4bit_quant_type="nf4",
|
| 77 |
-
# bnb_4bit_use_double_quant=True,
|
| 78 |
-
# )
|
| 79 |
-
|
| 80 |
# Load model
|
| 81 |
model = AutoModelForCausalLM.from_pretrained(
|
| 82 |
model_name,
|
| 83 |
torch_dtype=torch.bfloat16,
|
| 84 |
use_cache=False, # Disable KV cache during training
|
| 85 |
device_map="auto",
|
| 86 |
-
# quantization_config=quantization_config
|
| 87 |
)
|
| 88 |
|
| 89 |
# Load tokenizer
|
|
|
|
| 11 |
# "trl",
|
| 12 |
# "peft",
|
| 13 |
# "wandb",
|
|
|
|
| 14 |
# "torchvision",
|
| 15 |
# "torchaudio",
|
| 16 |
# ]
|
|
|
|
| 21 |
|
| 22 |
import torch
|
| 23 |
from datasets import load_dataset
|
| 24 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
from trl import SFTConfig, SFTTrainer, setup_chat_format
|
| 26 |
from peft import LoraConfig
|
| 27 |
|
|
|
|
| 69 |
|
| 70 |
"""## Load model and tokenizer"""
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
# Load model
|
| 73 |
model = AutoModelForCausalLM.from_pretrained(
|
| 74 |
model_name,
|
| 75 |
torch_dtype=torch.bfloat16,
|
| 76 |
use_cache=False, # Disable KV cache during training
|
| 77 |
device_map="auto",
|
|
|
|
| 78 |
)
|
| 79 |
|
| 80 |
# Load tokenizer
|