还在为大模型的部署和使用成本发愁吗?想体验顶尖模型的性能,又不想被高昂的费用劝退?现在,机会来了!今天要给大家介绍一款超给力的开源大模型——**Dots.LLM1**,它不仅性能出色,而且还非常友好,让咱们普通用户也能轻松上手。
**Dots.LLM1**可不是什么小角色,它是由rednote-hilab团队精心打造的混合专家模型(MoE),总参数高达1420亿,但每次推理时只激活140亿参数,这种巧妙的设计让它在保证强大性能的同时,大大降低了计算成本。
**Dots.LLM1的亮点:**
* **媲美顶尖模型的性能:** 经过11.2T高质量token的预训练,Dots.LLM1的性能可以与Qwen2.5-72B相媲美,这意味着什么?你可以用它来完成各种复杂的自然语言处理任务,比如文本生成、问答、翻译等等,而且效果杠杠的!
* **高效的数据处理流程:** 为了训练出高质量的模型,Dots.LLM1团队设计了一套精细的三阶段数据处理框架,确保了数据的规模、质量和多样性。
* **不使用合成数据:** 所有的预训练数据都是真实数据,没有使用任何合成数据,这保证了模型的真实性和可靠性。
* **开源开放:** Dots.LLM1是完全开源的,你可以免费使用它,也可以根据自己的需求进行修改和定制。更棒的是,官方还发布了每个1T token训练的中间检查点,这对于研究大模型的学习过程非常有价值。
* **多种部署方式:** Dots.LLM1支持多种部署方式,你可以选择Docker、Hugging Face Transformers、vLLM或者SGLang,总有一种方式适合你。
**Dots.LLM1的用法:**
说了这么多,大家可能最关心的还是怎么用Dots.LLM1。别担心,官方提供了非常详细的教程,下面我给大家简单介绍一下:
1. **模型下载:**
首先,你需要从Hugging Face下载模型,有两个版本可以选择:
* `dots.llm1.base`:基础模型,适合进行文本补全等任务。
* `dots.llm1.inst`:指令微调模型,适合进行对话等任务。
2. **Docker部署(推荐):**
如果你熟悉Docker,这是最方便的部署方式。官方提供了Docker镜像,你可以直接使用vLLM来启动服务。
“`bash
docker run –gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-p 8000:8000 \
–ipc=host \
rednotehilab/dots1:vllm-openai-v0.9.0.1 \
–model rednote-hilab/dots.llm1.inst \
–tensor-parallel-size 8 \
–trust-remote-code \
–served-model-name dots1
“`
启动成功后,你可以使用curl命令来测试模型是否正常运行:
“`bash
curl http://localhost:8000/v1/chat/completions \
-H “Content-Type: application/json” \
-d ‘{
“model”: “dots1”,
“messages”: [
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: “Who won the world series in 2020?”}
],
“max_tokens”: 32,
“temperature”: 0
}’
“`
3. **Hugging Face Transformers部署:**
如果你更喜欢使用Hugging Face Transformers,也可以直接加载模型进行推理。
* **文本补全:**
“`python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
model_name = “rednote-hilab/dots.llm1.base”
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map=”auto”, torch_dtype=torch.bfloat16)
text = “An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is”
inputs = tokenizer(text, return_tensors=”pt”)
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)
“`
* **对话:**
“`python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
model_name = “rednote-hilab/dots.llm1.inst”
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map=”auto”, torch_dtype=torch.bfloat16)
messages = [
{“role”: “user”, “content”: “Write a piece of quicksort code in C++”}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors=”pt”)
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=200)
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
“`
4. **vLLM部署:**
vLLM是一个高性能的LLM推理和服务引擎,可以显著提高推理速度和效率。
“`bash
vllm serve dots.llm1.inst –port 8000 –tensor-parallel-size 8
“`
5. **SGLang部署:**
SGLang是一个快速的大型语言模型和视觉语言模型服务框架。
“`bash
python -m sglang.launch_server –model-path dots.llm1.inst –tp 8 –host 0.0.0.0 –port 8000
“`
**总结:**
总而言之,**Dots.LLM1**是一款非常优秀的开源大模型,它不仅性能出色,而且还非常易于使用。无论你是研究人员还是开发者,都可以从中受益。赶快去Hugging Face下载体验吧!相信它会给你带来惊喜!
rednote-hilab/dots.llm1
https://github.com/rednote-hilab/dots.llm1
暂无评论内容