Mobillama 1B Chat
MobiLlama-1B-Chat是基于MobiLlama-1B微调的指令跟随模型,专为资源受限设备设计,强调高效、低内存占用和快速响应。
下载量 44
发布时间 : 2/25/2024
模型简介
这是一个小型语言模型(SLM),适用于需要设备端处理、能效高、内存占用低和响应效率高的场景,特别关注隐私、安全和可持续部署。
模型特点
资源高效
专为资源受限设备设计,参数共享方案降低了预训练和部署成本
完全透明
提供完整的训练数据管道、训练代码、模型权重和评估代码
指令跟随
经过微调能够有效理解和执行人类指令
模型能力
文本生成
指令理解
对话系统
使用案例
教育
儿童活动建议
为家长提供适合儿童的活动创意和建议
生成详细的活动方案和注意事项
健康
正念冥想指导
提供正念冥想的方法和好处说明
详细解释冥想技巧和科学依据
🚀 MobiLlama-1B-Chat
我们推出了 MobiLlama-1.2B-Chat,这是一个在 MBZUAI/MobiLlama-1B 基础上微调的指令跟随模型。它旨在满足资源受限设备的特定需求,在降低资源需求的同时提升性能。

🚀 快速开始
加载 MobiLlama-1B-Chat
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("MBZUAI/MobiLlama-1B-Chat", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("MBZUAI/MobiLlama-1B-Chat", trust_remote_code=True)
model.to('cuda')
#template adapated from fastchat
template= "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n### Human: Got any creative ideas for a 10 year old’s birthday?\n### Assistant: Of course! Here are some creative ideas for a 10-year-old's birthday party:\n1. Treasure Hunt: Organize a treasure hunt in your backyard or nearby park. Create clues and riddles for the kids to solve, leading them to hidden treasures and surprises.\n2. Science Party: Plan a science-themed party where kids can engage in fun and interactive experiments. You can set up different stations with activities like making slime, erupting volcanoes, or creating simple chemical reactions.\n3. Outdoor Movie Night: Set up a backyard movie night with a projector and a large screen or white sheet. Create a cozy seating area with blankets and pillows, and serve popcorn and snacks while the kids enjoy a favorite movie under the stars.\n4. DIY Crafts Party: Arrange a craft party where kids can unleash their creativity. Provide a variety of craft supplies like beads, paints, and fabrics, and let them create their own unique masterpieces to take home as party favors.\n5. Sports Olympics: Host a mini Olympics event with various sports and games. Set up different stations for activities like sack races, relay races, basketball shooting, and obstacle courses. Give out medals or certificates to the participants.\n6. Cooking Party: Have a cooking-themed party where the kids can prepare their own mini pizzas, cupcakes, or cookies. Provide toppings, frosting, and decorating supplies, and let them get hands-on in the kitchen.\n7. Superhero Training Camp: Create a superhero-themed party where the kids can engage in fun training activities. Set up an obstacle course, have them design their own superhero capes or masks, and organize superhero-themed games and challenges.\n8. Outdoor Adventure: Plan an outdoor adventure party at a local park or nature reserve. Arrange activities like hiking, nature scavenger hunts, or a picnic with games. Encourage exploration and appreciation for the outdoors.\nRemember to tailor the activities to the birthday child's interests and preferences. Have a great celebration!\n### Human: {prompt}\n### Assistant:"
prompt = "What are the key benefits of practicing mindfulness meditation?"
input_str = template.format(prompt=prompt)
input_ids = tokenizer(input_str, return_tensors="pt").to('cuda').input_ids
outputs = model.generate(input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
print(tokenizer.batch_decode(outputs[:, input_ids.shape[1]:-1])[0].strip())
或者,你可以使用 FastChat:
python3 -m fastchat.serve.cli --model-path MBZUAI/MobiLlama-1B-Chat
✨ 主要特性
在近期大语言模型(LLM)的发展中,“越大越好”一直是主流趋势。然而,大语言模型并不适合需要设备端处理、能源效率、低内存占用和响应效率的场景。这些要求对于隐私、安全和可持续部署至关重要。本文通过应对为资源受限设备设计准确且高效的小语言模型(SLM)这一挑战,探索了“少即是多”的范式。我们的主要贡献是推出了一个准确且完全透明的开源 5 亿(0.5B)参数的小语言模型 MobiLlama,它满足资源受限计算的特定需求,强调在降低资源需求的同时提升性能。MobiLlama 是一种小语言模型设计,它从一个更大的模型开始,并应用了一种谨慎的参数共享方案,以降低预训练和部署成本。我们的工作不仅努力填补开源小语言模型的空白,还确保了完全透明,完整的训练数据管道、训练代码、模型权重以及 300 多个检查点和评估代码都可以在我们的 Github 上找到。
📚 详细文档
模型描述
属性 | 详情 |
---|---|
模型类型 | 基于 LLaMA - 7B 架构设计构建的小语言模型(SLM) |
语言(NLP) | 英语 |
许可证 | Apache 2.0 |
更多信息资源 | - 训练代码 - 数据准备 - 完全处理后的 Amber 预训练数据 |
MobiLlama-1B-Chat 微调详情
DataMix
子集 | 行数 | 许可证 |
---|---|---|
WizardLM/WizardLM_evol_instruct_V2_196k | 143k | |
icybee/share_gpt_90k_v1 | 90k | cc0 - 1.0 |
总计 | 233k |
超参数
超参数 | 值 |
---|---|
总参数 | 1.2B |
隐藏层大小 | 2048 |
中间层大小(MLPs) | 5632 |
注意力头数量 | 32 |
隐藏层数量 | 22 |
RMSNorm ɛ | 1e^ - 5 |
最大序列长度 | 2048 |
词表大小 | 32000 |
训练超参数 | 值 |
---|---|
学习率 | 2e - 5 |
训练轮数 | 3 |
每个设备的训练批次大小 | 2 |
梯度累积步数 | 16 |
热身比例 | 0.04 |
模型最大长度 | 2048 |
评估
评估基准 | MobiLlama - 05B - Chat | MobiLlama - 1.2B - Chat |
---|---|---|
HellaSwag | 0.5042 | 0.6244 |
MMLU | 0.2677 | 0.2635 |
Arc Challenge | 0.2935 | 0.3558 |
TruthfulQA | 0.3997 | 0.3848 |
CrowsPairs | 0.5694 | 0.679 |
PIQA | 0.7078 | 0.7557 |
Race | 0.3320 | 0.3598 |
SIQA | 0.4165 | 0.4396 |
Winogrande | 0.5659 | 0.5966 |
引用
BibTeX:
@misc{thawakar2024mobillama,
title={MobiLlama: Towards Accurate and Lightweight Fully Transparent GPT},
author={Omkar Thawakar and Ashmal Vayani and Salman Khan and Hisham Cholakkal and Rao Muhammad Anwer and Michael Felsberg and Timothy Baldwin and Eric P. Xing and Fahad Shahbaz Khan},
year={2024},
eprint={2402.16840},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📄 许可证
本模型使用 Apache 2.0 许可证。
Phi 2 GGUF
其他
Phi-2是微软开发的一个小型但强大的语言模型,具有27亿参数,专注于高效推理和高质量文本生成。
大型语言模型 支持多种语言
P
TheBloke
41.5M
205
Roberta Large
MIT
基于掩码语言建模目标预训练的大型英语语言模型,采用改进的BERT训练方法
大型语言模型 英语
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基础模型的蒸馏版本,在保持相近性能的同时更轻量高效,适用于序列分类、标记分类等自然语言处理任务。
大型语言模型 英语
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一个多语言大语言模型,针对多语言对话用例进行了优化,在常见的行业基准测试中表现优异。
大型语言模型 英语
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基于100种语言的2.5TB过滤CommonCrawl数据预训练的多语言模型,采用掩码语言建模目标进行训练。
大型语言模型 支持多种语言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基于Transformer架构的英语预训练模型,通过掩码语言建模目标在海量文本上训练,支持文本特征提取和下游任务微调
大型语言模型 英语
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI发布的开放预训练Transformer语言模型套件,参数量从1.25亿到1750亿,旨在对标GPT-3系列性能,同时促进大规模语言模型的开放研究。
大型语言模型 英语
O
facebook
6.3M
198
1
基于transformers库的预训练模型,适用于多种NLP任务
大型语言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多语言大语言模型系列,包含8B、70B和405B参数规模,支持8种语言和代码生成,优化了多语言对话场景。
大型语言模型
Transformers 支持多种语言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基础版是由Google开发的文本到文本转换Transformer模型,参数规模2.2亿,支持多语言NLP任务。
大型语言模型 支持多种语言
T
google-t5
5.4M
702
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98