Update README.md
Browse files
README.md
CHANGED
|
@@ -1,20 +1,49 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
LoRA adapters for the Humanities tutor in the Canis.teach suite.
|
| 4 |
|
| 5 |
-
- Base
|
| 6 |
-
- Release
|
| 7 |
-
- Project
|
| 8 |
-
-
|
| 9 |
|
| 10 |
## What is this?
|
| 11 |
|
| 12 |
-
This repository provides LoRA adapters fine
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
```python
|
| 19 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 20 |
from peft import PeftModel
|
|
@@ -22,58 +51,102 @@ from peft import PeftModel
|
|
| 22 |
base = "Qwen/Qwen3-4B-Instruct-2507"
|
| 23 |
adapter = "CanisAI/teach-humanities-qwen3-4b-2507-r1"
|
| 24 |
|
| 25 |
-
|
| 26 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
model = PeftModel.from_pretrained(model, adapter)
|
| 28 |
|
|
|
|
| 29 |
prompt = "Explain three key causes of the French Revolution in clear, simple terms."
|
| 30 |
-
inputs =
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
```
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
-
|
| 38 |
-
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
- Method: SFT with TRL; LoRA on Transformer projection layers (Unsloth + PEFT)
|
| 45 |
-
- Goal: Clear, step‑by‑step pedagogy and helpful hints across subjects
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
- Suitable for educational prototypes, demonstrations, and research.
|
| 51 |
-
- Built to “teach, not just answer”: stepwise hints, clarity, and rubric‑aligned structure.
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
- For fact‑heavy tasks, consider Retrieval‑Augmented Generation (RAG) with curriculum sources.
|
| 57 |
-
- Follow data privacy and compliance rules in your environment (e.g., school policies).
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
-
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
## License
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
## Acknowledgments
|
| 74 |
|
| 75 |
-
-
|
| 76 |
-
- Unsloth
|
| 77 |
-
-
|
|
|
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen3-4B-Instruct-2507
|
| 7 |
+
base_model_relation: adapter
|
| 8 |
+
library_name: peft
|
| 9 |
+
tags:
|
| 10 |
+
- canis-teach
|
| 11 |
+
- qwen3
|
| 12 |
+
- education
|
| 13 |
+
- lora
|
| 14 |
+
- transformers
|
| 15 |
+
- humanities
|
| 16 |
+
- tutoring
|
| 17 |
+
pipeline_tag: text-generation
|
| 18 |
+
datasets:
|
| 19 |
+
- CanisAI/teach-humanities-v1
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Canis.teach - Qwen3-4B Instruct (Humanities)
|
| 23 |
|
| 24 |
LoRA adapters for the Humanities tutor in the Canis.teach suite.
|
| 25 |
|
| 26 |
+
- **Base Model**: Qwen/Qwen3-4B-Instruct-2507
|
| 27 |
+
- **Release**: CanisAI/teach-humanities-qwen3-4b-2507-r1
|
| 28 |
+
- **Project**: Canis.teach - Learning that fits.
|
| 29 |
+
- **Subject**: Humanities
|
| 30 |
|
| 31 |
## What is this?
|
| 32 |
|
| 33 |
+
This repository provides LoRA adapters fine-tuned on Humanities tutoring dialogues. Apply these adapters to the base model to enable subject-aware, didactic behavior without downloading a full merged checkpoint.
|
| 34 |
|
| 35 |
+
The model is designed to **teach, not just answer** - providing step-by-step explanations, hints, and pedagogically structured responses.
|
| 36 |
|
| 37 |
+
For ready-to-run merged models or Ollama-friendly GGUF quantizations, see the "Related Models" section.
|
| 38 |
|
| 39 |
+
## Quick Start
|
| 40 |
+
|
| 41 |
+
### Installation
|
| 42 |
+
```bash
|
| 43 |
+
pip install transformers peft torch
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
### Usage (LoRA)
|
| 47 |
```python
|
| 48 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 49 |
from peft import PeftModel
|
|
|
|
| 51 |
base = "Qwen/Qwen3-4B-Instruct-2507"
|
| 52 |
adapter = "CanisAI/teach-humanities-qwen3-4b-2507-r1"
|
| 53 |
|
| 54 |
+
tokenizer = AutoTokenizer.from_pretrained(base, use_fast=True)
|
| 55 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 56 |
+
base,
|
| 57 |
+
device_map="auto",
|
| 58 |
+
torch_dtype="auto"
|
| 59 |
+
)
|
| 60 |
model = PeftModel.from_pretrained(model, adapter)
|
| 61 |
|
| 62 |
+
# Example prompt
|
| 63 |
prompt = "Explain three key causes of the French Revolution in clear, simple terms."
|
| 64 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 65 |
+
outputs = model.generate(
|
| 66 |
+
**inputs,
|
| 67 |
+
max_new_tokens=256,
|
| 68 |
+
temperature=0.7,
|
| 69 |
+
top_p=0.8,
|
| 70 |
+
top_k=20,
|
| 71 |
+
do_sample=True
|
| 72 |
+
)
|
| 73 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 74 |
```
|
| 75 |
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
- **Base Model**: Qwen/Qwen3-4B-Instruct-2507
|
| 79 |
+
- **Training Method**: Supervised Fine-Tuning (SFT) with LoRA
|
| 80 |
+
- **Framework**: Unsloth + TRL/PEFT
|
| 81 |
+
- **Data**: Canis.lab-curated Humanities tutoring dialogues
|
| 82 |
+
- **Target Modules**: Query, Key, Value, Output projections
|
| 83 |
+
- **Rank**: 16
|
| 84 |
+
- **Alpha**: 32
|
| 85 |
+
|
| 86 |
+
## Intended Use
|
| 87 |
|
| 88 |
+
- **Primary**: Subject-aware tutoring for Humanities education
|
| 89 |
+
- **Applications**: Educational prototypes, tutoring systems, research
|
| 90 |
+
- **Approach**: Stepwise explanations, pedagogical hints, rubric-aligned responses
|
| 91 |
+
- **Target Audience**: Students, educators, researchers
|
| 92 |
|
| 93 |
+
## Model Behavior
|
|
|
|
|
|
|
| 94 |
|
| 95 |
+
The model is optimized for:
|
| 96 |
+
- Clear, step-by-step explanations
|
| 97 |
+
- Appropriate difficulty progression
|
| 98 |
+
- Encouraging learning through hints rather than direct answers
|
| 99 |
+
- Subject-specific pedagogical approaches
|
| 100 |
+
- Maintaining educational standards and accuracy
|
| 101 |
|
| 102 |
+
## Recommended Settings
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
For optimal tutoring behavior:
|
| 105 |
+
- **Temperature**: 0.6-0.8
|
| 106 |
+
- **Top-p**: 0.8-0.9
|
| 107 |
+
- **Top-k**: 20-40
|
| 108 |
+
- **Max tokens**: 256-512 (depending on complexity)
|
| 109 |
|
| 110 |
+
## Safety and Limitations
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
**Important Considerations**:
|
| 113 |
+
- Human oversight required for educational use
|
| 114 |
+
- May occasionally hallucinate or oversimplify complex topics
|
| 115 |
+
- For fact-critical applications, consider RAG with verified curriculum sources
|
| 116 |
+
- Follow your institution's data privacy and AI usage policies
|
| 117 |
+
- Not a replacement for qualified human instruction
|
| 118 |
|
| 119 |
+
## Related Models
|
| 120 |
+
|
| 121 |
+
| Type | Repository | Description |
|
| 122 |
+
|------|------------|-------------|
|
| 123 |
+
| **LoRA Adapters** | `CanisAI/teach-humanities-qwen3-4b-2507-r1` | This repository (lightweight) |
|
| 124 |
+
| **Merged Model** | `CanisAI/teach-humanities-qwen3-4b-2507-r1-merged` | Ready-to-use full model |
|
| 125 |
+
| **GGUF Quantized** | `CanisAI/teach-humanities-qwen3-4b-2507-r1-gguf` | Ollama/llama.cpp compatible |
|
| 126 |
+
| **Dataset** | `CanisAI/teach-humanities-v1` | Training data |
|
| 127 |
|
| 128 |
## License
|
| 129 |
|
| 130 |
+
This model inherits the license from the base model (Qwen/Qwen3-4B-Instruct-2507). Please review the base model's license terms before use.
|
| 131 |
+
|
| 132 |
+
## Citation
|
| 133 |
+
|
| 134 |
+
```bibtex
|
| 135 |
+
@misc{canis-teach-humanities,
|
| 136 |
+
title={Canis.teach Humanities Tutor},
|
| 137 |
+
author={CanisAI},
|
| 138 |
+
year={2025},
|
| 139 |
+
publisher={Hugging Face},
|
| 140 |
+
howpublished={\url{https://huggingface.co/CanisAI/teach-humanities-qwen3-4b-2507-r1}}
|
| 141 |
+
}
|
| 142 |
+
```
|
| 143 |
|
| 144 |
## Acknowledgments
|
| 145 |
|
| 146 |
+
- **Qwen Team** for the excellent base model
|
| 147 |
+
- **Unsloth** for efficient training tools
|
| 148 |
+
- **Hugging Face** ecosystem (Transformers, PEFT, TRL)
|
| 149 |
+
- Educators and contributors supporting the Canis.teach project
|
| 150 |
|
| 151 |
+
---
|
| 152 |
+
**Canis.teach** - Learning that fits.
|