初始化项目,由ModelHub XC社区提供模型

Model: inclusionAI/Ling-lite-1.5
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-10-15 02:51:13 +08:00
commit 27896d8daf
15 changed files with 9577 additions and 0 deletions

49
.gitattributes vendored Normal file
View File

@@ -0,0 +1,49 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bin.* filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zstandard filter=lfs diff=lfs merge=lfs -text
*.tfevents* filter=lfs diff=lfs merge=lfs -text
*.db* filter=lfs diff=lfs merge=lfs -text
*.ark* filter=lfs diff=lfs merge=lfs -text
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.gguf* filter=lfs diff=lfs merge=lfs -text
*.ggml filter=lfs diff=lfs merge=lfs -text
*.llamafile* filter=lfs diff=lfs merge=lfs -text
*.pt2 filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
tokenizer.json filter=lfs diff=lfs merge=lfs -text

21
LICENCE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 inclusionAI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

119
README.md Normal file
View File

@@ -0,0 +1,119 @@
---
license: mit
pipeline_tag: text-generation
library_name: transformers
---
# Ling
[Paper](https://hf.co/papers/2503.05139)
<p align="center"><img src="https://huggingface.co/inclusionAI/Ling-lite/resolve/main/ant-bailing.png" width="100"/></p>
<p align="center">🤗 <a href="https://huggingface.co/inclusionAI">Hugging Face</a></p>
## Introduction
Ling is a MoE LLM provided and open-sourced by InclusionAI. We introduce two different sizes, which are Ling-lite and Ling-plus. Ling-lite has 16.8 billion parameters with 2.75 billion activated parameters, while Ling-plus has 290 billion parameters with 28.8 billion activated parameters. Both models demonstrate impressive performance compared to existing models in the industry.
Their structure makes it easy to scale up and down and adapt to different tasks, so users can use these models for a wide range of tasks, from processing natural language to solving complex problems. Furthermore, the open-source nature of Ling promotes collaboration and innovation within the AI community, fostering a diverse range of use cases and enhancements.
As more developers and researchers engage with the platform, we can expect rapid advancements and improvements, leading to even more sophisticated applications. This collaborative approach accelerates development and ensures that the models remain at the forefront of technology, addressing emerging challenges in various fields.
## Model Downloads
You can download the following table to see the various parameters for your use case. If you are located in mainland China, we also provide the model on ModelScope.cn to speed up the download process.
| **Model** | **#Total Params** | **#Activated Params** | **Context Length** | **Download** |
| :----------------: | :---------------: | :-------------------: | :----------------: | :----------: |
| Ling-lite-base-1.5 | 16.8B | 2.75B | 128K | [🤗 HuggingFace](https://huggingface.co/inclusionAI/Ling-lite-base-1.5) |
| Ling-lite-1.5 | 16.8B | 2.75B | 128K | [🤗 HuggingFace](https://huggingface.co/inclusionAI/Ling-lite-1.5) |
## Evaluation
| **Benchmark** | **#shots** | **Ling-lite-1.5** | **Ling-lite** | **Qwen3-4B-Instruct** | **Qwen3-8B-Instruct** | **Moonlight-16B-A3B-Instruct** | **LLaMA3.1-8B** |
| :--------------------------------------------: | :--------: | :---------------: | :-----------: | :-------------------: | :-------------------: | :-----------: | :-------------: |
| MMLU(EM) | 5 | **74.33** | 71.27 | 70.09 | 75.97 | 70.74 | 68.67 |
| GPQA(Pass@1) | 0 | **36.55** | 29.73 | 40.4 | 47.10 | 19.51 | 27.59 |
| HumanEval(Pass@1) | 0 | **87.27** | 84.38 | 81.94 | 85.29 | 72.94 | 67.23 |
| LiveCodeBench 2408-2502 (Pass@1) | 0 | **22.7** | 18.94 | 21.8 | 26.88 | 14.76 | 18.41 |
| LCBench(pass@1) | 0 | **60.37** | 46.57 | 48.61 | 60.03 | 28.39 | 23.13 |
| Math(EM) | 0 | **82.62** | 72.80 | 81.46 | 82.70 | 67.1 | 52.42 |
| AIME2024(pass@1) | 0 | **21.88** | 10.21 | 20.62 | 26.25 | 6.88 | 7.29 |
| OlympiadBench(pass@1) | 0 | **52.30** | 36.44 | 54.33 | 56.11 | 32.85 | 17.04 |
| BBH(EM) | 0 | **75.75** | 66.38 | 78.21 | 79.33 | 63.45 | 68.05 |
| IFEval(Prompt Strict) | 0 | **77.70** | 77.99 | 81.06 | 83.55 | 49.01 | 73.01 |
| BFCL_live | 0 | **72.15** | 67.93 | 65.35 | 69.83 | 47.14 | 49.98 |
#### Context Window
![undefined](https://intranetproxy.alipay.com/skylark/lark/0/2025/png/19756943/1747044731734-f55a4411-7a0e-450d-be53-4de7b77f6521.png)
Evaluation results on the ``Needle In A Haystack`` (NIAH) tests. Ling-Lite-1.5 has improved long text generation capability and performs well across most context window lengths up to **128K**.
## Quickstart
### 🤗 Hugging Face Transformers
Here is a code snippet to show you how to use the chat model with `transformers`:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "inclusionAI/Ling-lite-1.5"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to large language models."
messages = [
{"role": "system", "content": "You are Ling, an assistant created by inclusionAI"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
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]
```
## Deployment
Please refer to [Github](https://github.com/inclusionAI/Ling/blob/master/README.md)
## License
This code repository is licensed under [the MIT License](https://huggingface.co/inclusionAI/Ling-lite/blob/main/LICENCE).
## Citation
If you find our work helpful, feel free to give us a cite.
```
@article{ling,
title = {Every FLOP Counts: Scaling a 300B Mixture-of-Experts LING LLM without Premium GPUs},
author = {Ling Team},
journal = {arXiv preprint arXiv:2503.05139},
year = {2025}
}
```
![--](https://ospo-insights.oss-cn-hangzhou.aliyuncs.com/iai-hf-models/Ling-lite-1.5.gif)

44
config.json Normal file
View File

@@ -0,0 +1,44 @@
{
"architectures": [
"BailingMoeForCausalLM"
],
"attention_dropout": 0.0,
"auto_map": {
"AutoConfig": "configuration_bailing_moe.BailingMoeConfig",
"AutoModel": "modeling_bailing_moe.BailingMoeModel",
"AutoModelForCausalLM": "modeling_bailing_moe.BailingMoeForCausalLM"
},
"eos_token_id": 126081,
"pad_token_id": 126081,
"first_k_dense_replace": 0,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.006,
"intermediate_size": 1408,
"max_position_embeddings": 32768,
"model_type": "bailing_moe",
"moe_intermediate_size": 1408,
"num_experts": 64,
"num_shared_experts": 2,
"norm_topk_prob": true,
"num_attention_heads": 16,
"num_experts_per_tok": 6,
"num_hidden_layers": 28,
"num_key_value_heads": 4,
"pretraining_tp": 1,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 600000,
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.40.0",
"use_cache": true,
"use_bias": false,
"use_qkv_bias": false,
"vocab_size": 126464,
"output_router_logits": false,
"embedding_dropout": 0.0,
"norm_head": false,
"norm_softmax": false,
"output_dropout": 0.0
}

1
configuration.json Normal file
View File

@@ -0,0 +1 @@
{"framework":"Pytorch","task":"text-generation"}

View File

@@ -0,0 +1,78 @@
""" Bailing MoE model configuration """
from transformers.configuration_utils import PretrainedConfig
class BailingMoeConfig(PretrainedConfig):
model_type = "bailing_moe"
def __init__(
self,
vocab_size=30592,
hidden_size=1024,
intermediate_size=None,
num_hidden_layers=24,
num_attention_heads=16,
num_key_value_heads=0,
hidden_act="silu",
use_qkv_bias=False, # bailing only
use_bias=True, # bailing only
rms_norm_eps=1e-05,
norm_head=False, # bailing only
tie_word_embeddings=False, # PretrainedConfig key, here change default value.
embedding_dropout=0.1,
attention_dropout=0.1,
output_dropout=0.1,
initializer_range=0.02,
max_position_embeddings=16384,
rope_theta=10000.0,
use_cache=True,
use_sliding_window=False,
sliding_window=4096,
max_window_layers=28,
rope_scaling=None,
pad_token_id=126081,
num_experts=16,
num_shared_experts=0,
num_experts_per_tok=2,
norm_topk_prob=True,
moe_intermediate_size=None,
first_k_dense_replace=0,
head_dim=None,
output_router_logits=False,
**kwargs,
):
self.num_hidden_layers = num_hidden_layers
self.vocab_size = vocab_size
self.hidden_size = hidden_size
self.intermediate_size = intermediate_size
self.num_attention_heads = num_attention_heads
self.num_key_value_heads = num_key_value_heads
self.hidden_act = hidden_act
self.use_qkv_bias = use_qkv_bias
self.use_bias = use_bias
self.norm_head = norm_head
self.rms_norm_eps = rms_norm_eps
self.embedding_dropout = embedding_dropout
self.attention_dropout = attention_dropout
self.output_dropout = output_dropout
self.initializer_range = initializer_range
self.max_position_embeddings = max_position_embeddings
self.rope_theta = rope_theta
self.use_cache = use_cache
self.use_sliding_window = use_sliding_window
self.sliding_window = sliding_window
self.max_window_layers = max_window_layers
self.head_dim = head_dim or self.hidden_size // self.num_attention_heads
self.rope_scaling = rope_scaling
# MoE configs
self.num_experts = num_experts
self.num_shared_experts = num_shared_experts
self.num_experts_per_tok = num_experts_per_tok
self.norm_topk_prob = norm_topk_prob
self.moe_intermediate_size = moe_intermediate_size
self.first_k_dense_replace = first_k_dense_replace
self.output_router_logits = output_router_logits
super().__init__(pad_token_id=pad_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs)

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b2ca5233f67d387722121cdbd6429a4cbb59f9b95a07c241846fa9f70be5fc42
size 9996618400

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d919ae267badc7ca4aaf127c667b64d83961d8ff71a3ff10ad63e0ad450ec624
size 9996077272

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:53486ae4cf49d98dda0399493d52b8d05013f3ac58630f2eed96b1aea17ff572
size 9995575912

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4475f04972cd760daa8b1bc6a0ed059444c57a8990cf300cfefe25c6cc4a075b
size 3616374272

5610
model.safetensors.index.json Normal file

File diff suppressed because it is too large Load Diff

1443
modeling_bailing_moe.py Normal file

File diff suppressed because it is too large Load Diff

38
special_tokens_map.json Normal file
View File

@@ -0,0 +1,38 @@
{
"additional_special_tokens": [
"<role>",
"</role>",
"<|arithmetic_start|>",
"<|arithmetic_end|>",
"<|number_start|>",
"<|number_end|>"
],
"bos_token": {
"content": "<|startoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"cls_token": {
"content": "[CLS]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a516ca7c2b9a6c3453d3eb85319e7cb7a970aa3d113ae4f3258a71501b7e39b
size 9747444

2159
tokenizer_config.json Normal file

File diff suppressed because it is too large Load Diff