Instructions to use posprivacy/teachmaster with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use posprivacy/teachmaster with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.8-27B") model = PeftModel.from_pretrained(base_model, "posprivacy/teachmaster") - Notebooks
- Google Colab
- Kaggle
TeachMaster Coder
Turn lesson text into animated teaching visuals.
Qwen3.8-27B · LoRA SFT · Remotion TSX
从课程文字出发,生成包含标题、图片、流程图、公式与动画的可执行 TSX。
Real model output. Gallery images are Remotion renders of this adapter's generated TSX. No manual layout repairs were applied. The speech-recognition illustrations are existing dataset assets referenced by the code; this model did not generate those images.
What It Does
TeachMaster Coder is a task-specific adapter for Chinese educational animation code generation. It takes lesson Markdown, image-planning JSON and presentation requirements, and produces complete React/Remotion TSX.
| Input | Output |
|---|---|
| Lesson content and terminology | Structured teaching scenes |
| Image descriptions, ratios and asset paths | Image placement with Img and staticFile |
| Canvas, timing and visual requirements | Components, layout styles and frame-based animation |
This repository contains the LoRA adapter, not the full base model. Use it with Qwen/Qwen3.8-27B. Source training data and image assets are not distributed here.
Generated Gallery
01 / From Audio to Understanding
An illustration, definition panel, processing pipeline and side-by-side comparison share one 1920 × 1080 canvas.
02 / Complex Environments, Structured Explanations
Image-and-text composition with three explanatory blocks, an audio-processing pipeline and application cards.
03 / A Concept Made Visible
A text-only lesson becomes an application overview and a highlighted Bayesian formula. This example uses no image assets.
See the remaining two scenes, including the sparse layout
The first scene defines prior probability and organizes three sources of prior knowledge.
The mechanism scene illustrates a remaining weakness: content is organized, but too much space is left unused in the middle of the frame.
How These Examples Were Checked
| Check | Observation |
|---|---|
| Evaluation data | 2 held-out pages; neither source job appears in this run's training split |
| Generation | Greedy decoding, thinking disabled, maximum 16,384 new tokens |
| Completion | Both outputs ended normally with EOS; 5,267 and 5,322 output tokens |
| Rendering | All 5 selected scene-end frames rendered without runtime errors |
| Layout inspection | No obvious clipping or text overlap in those screenshots |
| Scope | A small qualitative smoke test, not a full benchmark or all-frame audit |
The images above are selected still frames, not evidence of narration alignment or animation quality across the full timeline. The model produced 16- and 21-second compositions despite a request for approximately 40 seconds.
Training at a Glance
| Configuration | |
|---|---|
| Base model | Qwen/Qwen3.8-27B |
| Transformers architecture | Qwen3_5ForConditionalGeneration |
| Training / validation | 11,450 / 515 examples, split by source job |
| Objective | Supervised TSX generation; prompt tokens excluded from loss |
| Thinking | Disabled; no chain-of-thought supervision |
| LoRA | Rank 64 · alpha 128 · dropout 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Precision / hardware | BF16 · 8 × NVIDIA A800 80GB |
| Sequence cutoff | 12,288 tokens |
| Effective batch | 32 = 8 GPUs × microbatch 1 × accumulation 4 |
| Schedule | 2 epochs · 716 steps · peak LR 5e-5 · cosine decay · 3% warmup |
| Training runtime | Approximately 12.5 hours, excluding final evaluation |
| Final mean training loss | 0.185514 |
| Final validation loss | 0.173346 |
Length coverage: 479 training examples and 19 validation examples exceed the 12,288-token cutoff and are subject to truncation. The run does not cover every example at its original full length.
Learning Curves
Validation loss improved from 0.1851 at step 100 to 0.1733 at completion. Token loss measures code prediction; it does not directly measure layout aesthetics, content correctness or animation timing.
Quick Start
The tested runtime used Transformers 5.8, PEFT 0.18.1, PyTorch with BF16 support, flash-linear-attention and causal-conv1d. Install versions compatible with your CUDA/PyTorch environment. This base model uses the Qwen3.5 architecture implementation despite its Qwen3.8 model name.
import torch
from peft import PeftModel
from transformers import AutoTokenizer, Qwen3_5ForConditionalGeneration
base_id = "Qwen/Qwen3.8-27B"
adapter_id = "posprivacy/teachmaster-qwen38-27b-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base = Qwen3_5ForConditionalGeneration.from_pretrained(
base_id,
dtype=torch.bfloat16,
device_map="auto",
attn_implementation="sdpa",
)
model = PeftModel.from_pretrained(base, adapter_id).eval()
messages = [
{
"role": "system",
"content": (
"你是 Remotion TSX 代码生成器。只输出完整、可运行的 TSX。"
"画布为 1920x1080,fps=30。使用 Sequence 组织场景,"
"确保文字、图形和图片不出界、不重叠。"
),
},
{
"role": "user",
"content": '''【课程讲义 Markdown】
先验概率描述观测新数据之前对模型参数的初始判断。
它可以来自历史经验、科学理论和逻辑推演。
【图片规划 JSON】
{"needs_image": false, "images": []}
【当前分页文件名】
5_1.md
请用定义、流程图和应用示例组织画面。''',
},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
enable_thinking=False,
return_tensors="pt",
return_dict=True,
).to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=16384,
do_sample=False,
pad_token_id=tokenizer.eos_token_id,
)
tsx = tokenizer.decode(
output[0, inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(tsx)
This is a compact loading example. The gallery used a longer reconstructed coder system prompt specifying scene structure, typography, color palette, image integration and animation conventions. The short example above is not an exact reproduction of the gallery input.
Working With Images
Supply an image-planning JSON and an explicit path convention in the user message:
【图片规划 JSON】
{"needs_image": true, "images": [{"index": 1, "ratio": "16:9", "description": "端到端语音识别结构图"}]}
【当前分页文件名】
24_1.md
图片路径使用 staticFile("assets/24_1/image_<index>.png")。
Place the actual asset at public/assets/24_1/image_1.png in your Remotion project. The adapter generates the reference and layout; image generation and asset delivery are separate stages.
What Still Needs Work
- Space utilization: oversized cards, small text and excessive whitespace remain in some scenes.
- Timing compliance: requested composition duration is not reliably followed.
- Visual diversity: the gallery uses a shared template and palette supplied by the prompt; broader style generalization has not been established.
- Content accuracy: generated explanations and formulas still need subject-matter review.
- Runtime reliability: successful rendering of two samples does not establish a general compile-success rate.
- Animation and narration: these screenshots do not test all frames, narration generation or semantic audio alignment.
Generated TSX should be compiled, executed and visually inspected before use. The next useful quality checks are full-timeline rendering and DOM-based measurements of clipping, overlap and occupied area.
Repository Contents
| Files | Purpose |
|---|---|
adapter_model.safetensors, adapter_config.json |
LoRA weights and base-model reference |
tokenizer*, chat_template.jinja, processor_config.json |
Tokenization and supporting configuration |
train_results.json, eval_results.json |
Recorded training and evaluation metrics |
training_loss.png, training_eval_loss.png |
Learning curves |
assets/ |
Rendered gallery screenshots |
checksums.json |
Adapter SHA256 checksum |
The original base-model weights, training corpus and source image assets are not included. Refer to the base model's model card and license for its usage terms.
- Downloads last month
- 5,775
Model tree for posprivacy/teachmaster
Base model
Qwen/Qwen3.8-27B





