Views
No views yet
pip install transformers peft torch1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3
4base = "Qwen/Qwen3-4B-Instruct-2507"
5adapter = "CanisAI/teach-humanities-qwen3-4b-2507-r1"
6
7tokenizer = AutoTokenizer.from_pretrained(base, use_fast=True)
8model = AutoModelForCausalLM.from_pretrained(
9 base,
10 device_map="auto",
11 torch_dtype="auto"
12)
13model = PeftModel.from_pretrained(model, adapter)
14
15# Example prompt
16prompt = "Explain three key causes of the French Revolution in clear, simple terms."
17inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
18outputs = model.generate(
19 **inputs,
20 max_new_tokens=256,
21 temperature=0.7,
22 top_p=0.8,
23 top_k=20,
24 do_sample=True
25)
26print(tokenizer.decode(outputs[0], skip_special_tokens=True))| Type | Repository | Description |
|---|---|---|
| LoRA Adapters | CanisAI/teach-humanities-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-humanities-v1 | Training data |
1@misc{canis-teach-humanities,
2 title={Canis.teach Humanities Tutor},
3 author={CanisAI},
4 year={2025},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/CanisAI/teach-humanities-qwen3-4b-2507-r1}}
7}