Edit model card

image/webp

Gigi is fine-tuned on over 1.3 million pieces of high-quality Chinese-English bilingual corpus screened with the state-of-the-art Llama-3-8B-Instruct. It can better handle various downstream tasks and provide you with high-quality Chinese-English bilingual results. We incorporated high-quality fine-tuning data, such as Hermes and glaive-function-calling instructions, into the training, as well as a large amount of GPT4 data translated using GPT3.5. Gigi can meet your needs well in Chinese-English bilingual contexts.

GigiLlama-3-8B-Instruct 在超过130万条经过筛选的高质量中英双语语料上的精调模型,明显增强中文能力。

训练数据来源:

  • 英文OpenHermes-2.5 包含超过 100 万条 GPT-4 生成精调数据
  • 中文:超过20万条,包含多个高质量中文 SFT 数据集合和校正翻译的 GPT-4 生成数据。

Gigi-Llama-3-8B-zh

Gigi-Llama-3-8B-zh is the first model in the Gigi series, trained on the Hermes, glaive-function-calling, refgpt_fact_v2 datasets, and some Chinese data translated using GPT3.5. It has also improved the model's behavior in both Chinese and English and further enhanced its Chinese capabilities by incorporating datasets such as COIG-CQIA and alpaca-gpt4-data-zh.

Gigi-Llama-3-8B-zh 是 Gigi 系列的第一个模型,在Hermes、glaive-function-calling、refgpt_fact_v2数据集以及一部分使用GPT3.5翻译成的中文数据上训练,同时改进了模型在中英文上的行为,还加入了COIG-CQIA、alpaca-gpt4-data-zh等中文数据集进一步增强中文能力。

How to use

Gigi-Llama-3-8B-zh follows the dialogue template of Llama-3-8B-Instruct, using <|end_of_text|> as the pad token.

Gigi-Llama-3-8B-zh 遵循 Llama-3-8B-Instruct 的对话模板,pad token 使用 <|end_of_text|>

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

{{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>

{{ user_msg_1 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>

{{ model_answer_1 }}<|eot_id|>

You can use the following code to load the model for inference. For more efficient inference, it is recommended to use vLLM. We will introduce the specific performance of the model later, and will soon update to a larger parameter and better performance fine-tuned version.

您可以使用下面代码加载模型推理,对于更高效的推理建议使用vLLM,我们随后会介绍模型的具体性能,并很快更新更大参数和性能更好的精调版本。

import torch
from transformers import PreTrainedTokenizerFast, AutoModelForCausalLM
from peft import PeftModel
from torch.nn.functional import softmax
device = "cuda"

model_id = "yaojialzc/Gigi-Llama-3-8B-zh"
tokenizer = PreTrainedTokenizerFast.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
    model_path,
    device_map="auto",
    torch_dtype=torch.bfloat16)

messages = [
    {"role": "system", "content": "你是一个AI助手。"},
    {"role": "user", "content": "明朝最后一位皇帝是谁?回答他的名字,然后停止输出"},
]
prompt = tokenizer.apply_chat_template(
        messages, 
        tokenize=False, 
        add_generation_prompt=True
)
input_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt").to(device)

output = model.generate(
    input_ids,
    do_sample=True,
    temperature=0.01,
    top_k=50,
    top_p=0.7,
    repetition_penalty=1,
    max_length=128,
    pad_token_id=tokenizer.eos_token_id,
)
output = tokenizer.decode(output[0], skip_special_tokens=False)
print(output)

The model output of llama 3 does not stop at eot, so it cannot be used out of the box. For the time being, we respect the official behavior and guide the model to output "end_of_text" directly at the end of fine-tuning, making it convenient for immediate fine-tuning in downstream fields.

llama 3 模型输出 eot 时不会停止,无法开箱即用。我们暂时尊重官方的行为,精调时指导模型在最后直接输出 end_of_text,方便目前开箱即用地在下游领域精调。

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

Metric Value
Avg. 67.04
AI2 Reasoning Challenge (25-Shot) 59.64
HellaSwag (10-Shot) 80.28
MMLU (5-Shot) 66.91
TruthfulQA (0-shot) 52.14
Winogrande (5-shot) 76.48
GSM8k (5-shot) 66.79
Downloads last month
660
Safetensors
Model size
8.03B params
Tensor type
BF16
·
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 yaojialzc/Gigi-Llama3-8B-Chinese-zh

Finetunes
4 models
Quantizations
5 models

Dataset used to train yaojialzc/Gigi-Llama3-8B-Chinese-zh

Spaces using yaojialzc/Gigi-Llama3-8B-Chinese-zh 5

Collection including yaojialzc/Gigi-Llama3-8B-Chinese-zh

Evaluation results