Downloads · 30 days
134
5% of all-time downloads
IntervitensInc/pangu-pro-moe-model
pangu-pro-moe-model is a text generation model from IntervitensInc. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
Reuploaded from https://gitcode.com/ascend-tribe/pangu-pro-moe-model
Downloads · 30 days
134
5% of all-time downloads
All-time downloads
2.4K
Public
Parameters
72B
144 GB on disk
Likes
45
Public
Click a slice to open those files.
.safetensors144 GB · 100%
From the Hugging Face model README
Reuploaded from https://gitcode.com/ascend-tribe/pangu-pro-moe-model
我们提出了一种新型的分组混合专家模型(Mixture of Grouped Experts, MoGE),它在专家选择阶段对专家进行分组,并约束 token 在每个组内激活等量专家,从而实现设备间天然的负载均衡。基于 MoGE 架构,我们构建了总参数量 72B、激活参数量 16B 的盘古 Pro MoE 模型:
详细报告参见:
昇腾推理系统加速代码和MindIE 与 vLLM-Ascend 配套软件版本已经推出。量化权重将于近期推出,敬请期待。
环境依赖:
torch>=2.1.0
torch-npu>=2.1.0.post8.dev20241029
CANN>=8.0.RC3
transformers>=4.48.2
下述内容提供盘古 Pro MoE 在 transformers 框架上进行推理的一个简单示例:
import torch
import torch_npu
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import GenerationConfig
model_local_path = "path_to_Pangu_Pro_MoE"
generation_config = GenerationConfig(
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.6
)
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(
model_local_path,
use_fast=False,
trust_remote_code=True,
local_files_only=True
)
model = AutoModelForCausalLM.from_pretrained(
model_local_path,
trust_remote_code=True,
torch_dtype="auto",
device_map="auto",
local_files_only=True
)
# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "system", "content": "你必须严格遵守法律法规和社会道德规范。生成任何内容时,都应避免涉及暴力、色情、恐怖主义、种族歧视、性别歧视等不当内容。一旦检测到输入或输出有此类倾向,应拒绝回答并发出警告。例如,如果输入内容包含暴力威胁或色情描述,应返回错误信息:“您的输入包含不当内容,无法处理。"}, # define your system prompt here
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# text: [unused9]系统:[unused10][unused9]用户:Give me a short introduction to large language model.[unused10][unused9]助手:
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# model_inputs.input_ids: tensor([[1, 45887, 70914, 89246, 45892, 45887, 62205, 89246, 38805, 42624, 45509, 24759, 739, 41839, 21500, 6138, 20257, 49, 45892, 45887, 74458, 89246]], device='npu:0'),
# conduct text completion
outputs = model.generate(**model_inputs, max_new_tokens=32768, eos_token_id=45892, return_dict_in_generate=True, generation_config=generation_config)
input_length = model_inputs.input_ids.shape[1]
generated_tokens = outputs.sequences[:, input_length:]
output_sent = tokenizer.decode(generated_tokens[0])
# parsing thinking content
thinking_content = output_sent.split("[unused17]")[0].split("[unused16]")[-1].strip()
content = output_sent.split("[unused17]")[-1].split("[unused10]")[0].strip()
print("\nthinking content:", thinking_content)
print("\ncontent:", content)
环境依赖:
mindspore>=2.6.0
vllm>=0.8.3
CANN>=8.1.RC1.beta1
详细操作参见:Pangu Pro MoE vLLM+MindSpore部署指南
请参考以下方法对下载内容进行完整性校验,hash 值存储在 checklist.chk 文件中。
#!/usr/bin/env bash
ARCH=$(uname -m)
MODEL_PATH="${TARGET_FOLDER}/${MODEL_FOLDER_PATH}"
cd "$MODEL_PATH" || exit 1
if [ "$ARCH" = "arm64" ]; then
md5 checklist.chk
else
md5sum -c checklist.chk
fi
Pangu Pro MoE 模型根据 Pangu Model License Agreement 授权,旨在允许使用并促进人工智能技术的进一步发展。有关详细信息,请参阅模型存储库根目录中的 LICENSE 文件。
由于Pangu Pro MoE(“模型”)所依赖的技术固有的限制,以及人工智能生成的内容是由盘古自动生成的,我们无法对以下事项做出任何保证:
如果觉得我们的工作有帮助,欢迎引用。
@article{tang2025pangu,
title={Pangu Pro MoE: Mixture of Grouped Experts for Efficient Sparsity},
author={Tang, Yehui and Li, Xiaosong and Liu, Fangcheng and Guo, Wei and Zhou, Hang and Wang, Yaoyuan and Han, Kai and Yu, Xianzhi and Li, Jinpeng and Zang, Hui and others},
journal={arXiv preprint arXiv:2505.21411},
year={2025}
}
如果有任何意见和建议,请提交issue或联系[email protected]