Downloads · 30 days
13
4% of all-time downloads
RicardoLee/Llama2-base-7B-Chinese-50W-Full2LoRA
Llama2-base-7B-Chinese-50W-Full2LoRA is a text generation model from RicardoLee. Use it when you need the model to write or continue text. It is set up for transformers.
在完成了Llama2-chat 7B Chinese 和 Llama2-chat 13B Chinese 的训练后,我非常好奇能否直接基于Llama2-base 系列直接进行SFT训练。这也是本模型仓库的初衷。
Downloads · 30 days
13
4% of all-time downloads
All-time downloads
331
Public
Repo size
27.5 GB
Likes
9
Public
Click a slice to open those files.
.bin13.8 GB · 100%
From the Hugging Face model README
在完成了Llama2-chat 7B Chinese 和 Llama2-chat 13B Chinese 的训练后,我非常好奇能否直接基于Llama2-base 系列直接进行SFT训练。这也是本模型仓库的初衷。
但是在实际操作中,在用了原先chat模型的LoRA训练框架后,我发现基于Llama2 base的 LoRA 训练非常难以收敛,随时处于梯度爆炸的边缘。DeepSpeed 会频繁触发reduce scale 操作,最终scale太小越界导致训练崩溃。我遍历了LR 1e-5 - 2e-4,LoRA rank [4, 8, 64],LoRA Alpha [1,4,8,16,32],LoRA Dropout [0.05, 0.1] ,Warmup Ratio [0.01, 0.03, 0.05]等超参数,均无法稳定训练。因此,本模型采用先进行1 epoch的全量训练Llama2-base-7B-Chinese-50W-pre_release,然后在其上进行LoRA训练得到本模型仓库的模型。
由于网上存在使用LoRA 在英文SFT数据集上基于Llama2-base 进行SFT训练成功的样例,因此我怀疑难以训练的原因可能是扩中文词表embedding导致训练难度大幅度提升。
训练数据使用BELLE项目中采样的50万SFT数据进行SFT训练。
After finishing the training of Llama2-chat 7B Chinese and Llama2-chat 13B Chinese, I am deeply intrigued by the possibility of conducting SFT (Style-Fine-Tuning) training directly based on the Llama2-base series. This is the fundamental purpose of this model repository.
However, in real practice, I have observed that conducting LoRA training based on the Llama2 base model, within the framework of the previous Llama2-chat SFT project, presents significant challenges in achieving convergence. The gradient explosion happens in every training step and casue reducing scale operation in Deepspeed. In the end, the scale is too small and out of bounds, causing the training to crash. I have traversed LR 1e-5 - 2e-4,LoRA rank [4, 8, 64],LoRA Alpha [1,4,8,16,32],LoRA Dropout [0.05, 0.1] ,Warmup Ratio [0.01, 0.03, 0.05] and other hyperparameters, all of which cannot be trained stably. Therefore, this model has firstly reverted to a full-parameter SFT 1 epoch trainingLlama2-base-7B-Chinese-50W-pre_release, and then conducted a 2 epoch LoRA training. The reasons behind the difficulties encountered during LoRA training require further analysis.
As there are instances online where successful LoRA training on English SFT datasets using Llama2-base has been demonstrated, I suspect that the challenge in training might be attributed to the expansion of the Chinese word embedding, resulting in a substantial increase in training difficulty.
The training data is sampled from BELLE project, which consists of 500,000 SFT samples.
一些训练上的细节:
Some details in training:
该模型依然采用stanford alpaca 模版。因此在测试时且别忘记添加开场白。开场白如下:
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\n${Your Content}\n\n### Response:\n\n"
对于带上文的对话,开场白如下:
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\nHuman:${Previous Human Content}\nAssistant:${Previous Assistance Content}\nHuman:${Your Question}\n\n### Response:\n\n"
This model still using the Stanford Alpaca template. Therefore, don't forget to add prologue template. The prologue template is:
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\n${Your Content}\n\n### Response:\n\n"
For dialogue with context, the prelogue template is:
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\nHuman:${Previous Human Content}\nAssistant:${Previous Machine Content}\nHuman:${Your Question}\n\n### Response:\n\n"
本仓库的模型依照 Apache-2.0 协议开源,模型的权重的使用则需要遵循LLama2MODEL LICENCE。
This repository's models are open-sourced under the Apache-2.0 license, and their weight usage must adhere to LLama2 MODEL LICENCE license.
将会在近期逐步放出
I will release the following models: