Mxode / SmolLM-Chinese-180M

huggingface.co
Total runs: 2
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: September 18 2024
text-generation

Introduction of SmolLM-Chinese-180M

Model Details of SmolLM-Chinese-180M

SmolLM-Chinese-180M

Introduction

遵循 SmolLM 的做法,从头训练了一个 支持中英双语 的 SmolLM-Chinese-180M。

这并非在 SmolLM 基础上做中文继续预训练得到的模型,而是训练方法遵循 SmolLM 得到的新模型。

请注意: 这只是基座模型,未经过任何对齐。

Details

Tokenizer 选用了 Yi-1.5-9B-Chat 的。

模型结构选用最经典的 LLaMA。

模型参数设计遵循 Qwen2-0.5B ,根据测试,深而窄的模型表现比较好,并且对于小模型,FFN 的升维维度可以适当更大。

但出于训练速度考虑,并未采用深而窄的模型设计,适当减小了深度。

学习率调度方式采用 梯形调度 ,根据 SmolLM、MiniCPM 以及个人验证,在预训练上,效果确实好于余弦调度,并且梯形调度支持方便地增添数据和续训。

不同于 SmolLM 在最后 20% 的步骤开始衰减学习率,这里梯形调度的衰减步骤占比达到了 30%,采用和 MiniCPM 一致的指数衰减,最低衰减至最大学习率的 1%。

在非常多的开源数据集上进行了训练,并做了进一步筛选和过滤,因此仅列举了部分主要数据集。

训练数据整体比例大约为中文:英文:代码 = 4:4:2,同时中英文中均混合了一定的指令数据。

尚未进行任何基准测试。

How to Use
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_path = 'Mxode/SmolLM-Chinese-180M'

tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path).to('cuda:0', torch.float16)

def get_response(text: str, model, **kwargs):
    generation_args = dict(
        max_new_tokens = kwargs.pop("max_new_tokens", 512),
        do_sample = kwargs.pop("do_sample", True),
        temperature = kwargs.pop("temperature", 0.55),
        top_p = kwargs.pop("top_p", 0.8),
        top_k = kwargs.pop("top_k", 40),
        **kwargs
    )

    prompt = text
    model_inputs = tokenizer([prompt], return_tensors="pt").to(model.device)

    generated_ids = model.generate(model_inputs.input_ids, **generation_args)
    generated_ids = [
        output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
    ]

    response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
    return response

text = "牛奶作为人类日常必须的优良营养食品,"

response = get_response(text, model, max_new_tokens=256, do_sample=True, temperature=1.0)
print(f'{text}{response}')

Runs of Mxode SmolLM-Chinese-180M on huggingface.co

2
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About SmolLM-Chinese-180M huggingface.co Model

More SmolLM-Chinese-180M license Visit here:

https://choosealicense.com/licenses/gpl-3.0

SmolLM-Chinese-180M huggingface.co

SmolLM-Chinese-180M huggingface.co is an AI model on huggingface.co that provides SmolLM-Chinese-180M's model effect (), which can be used instantly with this Mxode SmolLM-Chinese-180M model. huggingface.co supports a free trial of the SmolLM-Chinese-180M model, and also provides paid use of the SmolLM-Chinese-180M. Support call SmolLM-Chinese-180M model through api, including Node.js, Python, http.

SmolLM-Chinese-180M huggingface.co Url

https://huggingface.co/Mxode/SmolLM-Chinese-180M

Mxode SmolLM-Chinese-180M online free

SmolLM-Chinese-180M huggingface.co is an online trial and call api platform, which integrates SmolLM-Chinese-180M's modeling effects, including api services, and provides a free online trial of SmolLM-Chinese-180M, you can try SmolLM-Chinese-180M online for free by clicking the link below.

Mxode SmolLM-Chinese-180M online free url in huggingface.co:

https://huggingface.co/Mxode/SmolLM-Chinese-180M

SmolLM-Chinese-180M install

SmolLM-Chinese-180M is an open source model from GitHub that offers a free installation service, and any user can find SmolLM-Chinese-180M on GitHub to install. At the same time, huggingface.co provides the effect of SmolLM-Chinese-180M install, users can directly use SmolLM-Chinese-180M installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

SmolLM-Chinese-180M install url in huggingface.co:

https://huggingface.co/Mxode/SmolLM-Chinese-180M

Url of SmolLM-Chinese-180M

SmolLM-Chinese-180M huggingface.co Url

Provider of SmolLM-Chinese-180M huggingface.co

Mxode
ORGANIZATIONS

Other API from Mxode