Edit model card

Unichat-llama3-Chinese-8B-28K

介绍

  • 中国联通AI创新中心发布业界第一个llama3中文指令微调模型长文本版本,全参数微调(非lora/longlora),2024年4月26日19点
  • 本模型以Meta Llama 3为基础,增加中文数据进行训练,实现llama3模型高质量中文问答
  • 此模型上下文原生长度28K
  • 基础模型 Meta-Llama-3-8B

📊 数据

  • 高质量长文本指令数据,覆盖多个领域和行业,为模型训练提供充足的数据支持
  • 微调指令数据经过严格的人工筛查,保证优质的指令数据用于模型微调

基础示例

  • 摘取《明朝那些事儿》小说第[319]章至[337]章内容约1万6千字左右,对文章内容进行提问。
  • 问:明朝三大营的组成及职责是什么?
  • 答:根据文章内容,明朝三大营的组成及职责如下:
  1. 五军营:由骑兵和步兵组成,分为中军、左军、左掖军、右掖军、右哨军,担任攻击的主力。

  2. 三千营:由投降的蒙古骑兵组成,主要是以雇佣兵为主的。下属全部都是骑兵,这支骑兵部队人数虽然不多,却是朱棣手下最为强悍的骑兵力量,他们在战争中主要担任突击的角色。

  3. 神机营:使用火炮和火铳等火器为主的部队,是明朝政府的炮兵部队。朱棣同志之所以要组建这样的一支部队,那是有着深刻原因的。

所以,明朝三大营的组成和职责是:五军营负责攻击,三千营负责突击,神机营负责使用火器进行打击。

快速开始

import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "UnicomAI/Unichat-llama3-Chinese-8B-28K"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device="cuda",
)


messages = [
    {"role": "system", "content": "A chat between a curious user and an artificial intelligence assistant.The assistant gives helpful, detailed, and polite answers to the user's questions."},
    {"role": "user", "content": "你是谁"},
]


prompt = pipeline.tokenizer.apply_chat_template(
      messages,
      tokenize=False,
      add_generation_prompt=True
)

terminators = [
      pipeline.tokenizer.eos_token_id,
      pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]


outputs = pipeline(
        prompt,
        max_new_tokens=2048,
        eos_token_id=terminators,
        do_sample=True,
        temperature=0.6,
        top_p=1,
        repetition_penalty=1.15
)
print(outputs[0]["generated_text"][len(prompt):])

资源

更多模型,数据集和训练相关细节请参考:

Downloads last month
526
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for UnicomLLM/Unichat-llama3-Chinese-8B-28K

Finetunes
3 models
Quantizations
2 models

Spaces using UnicomLLM/Unichat-llama3-Chinese-8B-28K 4