Views
No views yet
| 项目 | 详情 |
|---|---|
| 基础模型 | google/gemma-4-E4B-it(通过 unsloth 加速) |
| 微调方法 | LoRA(r=8, lora_alpha=8,仅更新语言层) |
| 训练数据 | 户晨风 2023–2025 年直播文字稿,489 个文件 |
| 训练样本 | 167,275 条单轮问答对 |
| 训练步数 | 2,000 步(Tesla T4,4-bit 量化) |
| 可训练参数 | 18,350,080 / 8,014,506,528(约 0.23%) |
| 发布格式 | GGUF Q8_0 |
某网友:你觉得这个事情怎么看?
户晨风:哎,我跟你讲,这个事情吧……prepare_dataset.py)的主要步骤:某网友 → user,户晨风 → assistant感谢XXX / 谢谢XXX(随机用户 ID),保留 感谢大家 / 谢谢主播 等通用表达………… → ……,!!! → ! 等1# 下载 GGUF 文件后
2llama-cli -m hcf-gemma-4-Q8_0.gguf \
3 --chat-template gemma \
4 -p "电车买什么好?" \
5 --temp 1.0 --top-p 0.95 --top-k 641from unsloth import FastModel
2from unsloth.chat_templates import get_chat_template
3
4model, tokenizer = FastModel.from_pretrained(
5 model_name="hasbai/hcf-gemma-4",
6 max_seq_length=1024,
7 load_in_4bit=True,
8)
9tokenizer = get_chat_template(tokenizer, chat_template="gemma-4")
10
11messages = [{"role": "user", "content": "你觉得年轻人现在最应该做什么?"}]
12inputs = tokenizer.apply_chat_template(
13 messages,
14 add_generation_prompt=True,
15 return_tensors="pt",
16 return_dict=True,
17).to("cuda")
18
19outputs = model.generate(
20 **inputs,
21 max_new_tokens=256,
22 temperature=1.0, top_p=0.95, top_k=64,
23)
24print(tokenizer.decode(outputs[0], skip_special_tokens=True))推荐推理参数:temperature=1.0, top_p=0.95, top_k=64(与 Gemma-4 官方推荐一致)
1# 1. 克隆仓库(含语料子模块)
2git clone --recurse-submodules https://github.com/hasbai/hcf
3cd hcf
4
5# 2. 生成训练数据
6python prepare_dataset.py --mode pair --output hcf_sft_pair.jsonl
7
8# 3. 在 Colab 运行训练 notebook
9# 见 Gemma4_(E4B)-Text.ipynb