Instructions to use CanisAI/teach-generalist-qwen3-4b-2507-r1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use CanisAI/teach-generalist-qwen3-4b-2507-r1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("base/Qwen/Qwen3-4B-Instruct-2507/") model = PeftModel.from_pretrained(base_model, "CanisAI/teach-generalist-qwen3-4b-2507-r1") - Transformers
How to use CanisAI/teach-generalist-qwen3-4b-2507-r1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CanisAI/teach-generalist-qwen3-4b-2507-r1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("CanisAI/teach-generalist-qwen3-4b-2507-r1", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CanisAI/teach-generalist-qwen3-4b-2507-r1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CanisAI/teach-generalist-qwen3-4b-2507-r1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CanisAI/teach-generalist-qwen3-4b-2507-r1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CanisAI/teach-generalist-qwen3-4b-2507-r1
- SGLang
How to use CanisAI/teach-generalist-qwen3-4b-2507-r1 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 "CanisAI/teach-generalist-qwen3-4b-2507-r1" \ --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": "CanisAI/teach-generalist-qwen3-4b-2507-r1", "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 "CanisAI/teach-generalist-qwen3-4b-2507-r1" \ --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": "CanisAI/teach-generalist-qwen3-4b-2507-r1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CanisAI/teach-generalist-qwen3-4b-2507-r1 with Docker Model Runner:
docker model run hf.co/CanisAI/teach-generalist-qwen3-4b-2507-r1
Canis.teach - Qwen3-4B Instruct (Generalist)
LoRA adapters for the Generalist tutor in the Canis.teach suite.
- Base Model: Qwen/Qwen3-4B-Instruct-2507
- Release: CanisAI/teach-generalist-qwen3-4b-2507-r1
- Project: Canis.teach - Learning that fits.
- Subject: Generalist
What is this?
This repository provides LoRA adapters fine-tuned on Generalist tutoring dialogues. Apply these adapters to the base model to enable subject-aware, didactic behavior without downloading a full merged checkpoint.
The model is designed to teach, not just answer - providing step-by-step explanations, hints, and pedagogically structured responses.
For ready-to-run merged models or Ollama-friendly GGUF quantizations, see the "Related Models" section.
Quick Start
Installation
pip install transformers peft torch
Usage (LoRA)
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "CanisAI/teach-generalist-qwen3-4b-2507-r1"
tokenizer = AutoTokenizer.from_pretrained(base, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
base,
device_map="auto",
torch_dtype="auto"
)
model = PeftModel.from_pretrained(model, adapter)
# Example prompt
prompt = "Explain how to solve 2x + 1 = 5 step by step."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.8,
top_k=20,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Training Details
- Base Model: Qwen/Qwen3-4B-Instruct-2507
- Training Method: Supervised Fine-Tuning (SFT) with LoRA
- Framework: Unsloth + TRL/PEFT
- Data: Canis.lab-curated Generalist tutoring dialogues
- Target Modules: Query, Key, Value, Output projections
- Rank: 16
- Alpha: 32
Intended Use
- Primary: Subject-aware tutoring for Generalist education
- Applications: Educational prototypes, tutoring systems, research
- Approach: Stepwise explanations, pedagogical hints, rubric-aligned responses
- Target Audience: Students, educators, researchers
Model Behavior
The model is optimized for:
- Clear, step-by-step explanations
- Appropriate difficulty progression
- Encouraging learning through hints rather than direct answers
- Subject-specific pedagogical approaches
- Maintaining educational standards and accuracy
Recommended Settings
For optimal tutoring behavior:
- Temperature: 0.6-0.8
- Top-p: 0.8-0.9
- Top-k: 20-40
- Max tokens: 256-512 (depending on complexity)
Safety and Limitations
Important Considerations:
- Human oversight required for educational use
- May occasionally hallucinate or oversimplify complex topics
- For fact-critical applications, consider RAG with verified curriculum sources
- Follow your institution's data privacy and AI usage policies
- Not a replacement for qualified human instruction
Related Models
| Type | Repository | Description |
|---|---|---|
| LoRA Adapters | CanisAI/teach-generalist-qwen3-4b-2507-r1 |
This repository (lightweight) |
| Merged Model | (Coming Soon) | Ready-to-use full model |
| GGUF Quantized | (Coming Soon) | Ollama/llama.cpp compatible |
| Dataset | CanisAI/teach-generalist-v1 |
Training data |
License
This model inherits the license from the base model (Qwen/Qwen3-4B-Instruct-2507). Please review the base model's license terms before use.
Citation
@misc{canis-teach-generalist,
title={Canis.teach Generalist Tutor},
author={CanisAI},
year={2024},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/CanisAI/teach-generalist-qwen3-4b-2507-r1}}
}
Acknowledgments
- Qwen Team for the excellent base model
- Unsloth for efficient training tools
- Hugging Face ecosystem (Transformers, PEFT, TRL)
- Educators and contributors supporting the Canis.teach project
Canis.teach - Learning that fits.
- Downloads last month
- 5
Model tree for CanisAI/teach-generalist-qwen3-4b-2507-r1
Base model
Qwen/Qwen3-4B-Instruct-2507