Downloads · 30 days
7
35% of all-time downloads
zhangux/TinyChat-0.1B
TinyChat-0.1B is a machine learning model from zhangux. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
TinyChat 是一个轻量级的大语言模型,采用现代化的 Transformer 架构设计。
Downloads · 30 days
7
35% of all-time downloads
All-time downloads
20
Public
Parameters
113M
450 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors450 MB · 100%
From the Hugging Face model README
TinyChat 是一个轻量级的大语言模型,采用现代化的 Transformer 架构设计。
- Layers: 12
- Hidden Size: 768
- Attention Heads: 16 (Query) / 4 (Key-Value)
- FFN Hidden Size: 3,072
- Dropout: 0.1
pip install transformers torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# 加载模型(需要设置 trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"tutututu1998/TinyChat-0.1B",
trust_remote_code=True
)
# 加载 tokenizer
tokenizer = AutoTokenizer.from_pretrained(
"tutututu1998/TinyChat-0.1B",
trust_remote_code=True
)
# 生成文本
inputs = tokenizer("你好,", return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=50,
temperature=0.7,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
texts = ["你好,", "今天天气", "人工智能"]
inputs = tokenizer(texts, return_tensors="pt", padding=True)
outputs = model.generate(**inputs, max_length=50)
for i, output in enumerate(outputs):
print(f"输入 {i+1}: {texts[i]}")
print(f"输出 {i+1}: {tokenizer.decode(output, skip_special_tokens=True)}")
print("-" * 50)
# 首次生成
inputs = tokenizer("你好,", return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=50,
use_cache=True # 启用 KV cache
)
TinyChat 使用 GQA 来减少 KV cache 的内存占用:
使用 RoPE 实现位置编码,参数:
[在此添加训练数据集、训练步数、超参数等信息]
[添加你的许可证信息]
如果你使用了这个模型,请引用:
@misc{tinychat2024,
author = {Your Name},
title = {TinyChat: A Lightweight Language Model},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/your-username/TinyChat-0.1B}}
}
[添加你的联系方式或 GitHub 链接]