魔搭社区每周速递(9.1-9.7)

简介: 182个模型、211个数据集、38个创新应用、6篇应用文章

image.png

🙋魔搭ModelScope本期社区进展:

📟182个模型:MiniCPM 3.0系列、Yi-Coder 系列、轩辕3-70B系列、天工奖励模型系列、MistoLine_Flux.dev、mini-omni等;

📁221个数据集:hermes-function-calling-v1、alpaca-cot-en-refined-by-data-juicer、alpaca_data等;

🎨38个创新应用MinerU、声音模型试听、矢量百宝箱等;

📄6篇文章:

  • 小而强大,零一万物编程小能手Yi-Coder系列模型开源!
  • 小钢炮进化,MiniCPM 3.0 开源!4B参数超GPT3.5性能,无限长文本,超

RAG三件套!模型推理、微调实战来啦!

  • 可控高清视频生成:CogVideoX+DiffSynth-Studio = “配置拉满”
  • 一键服务化:从魔搭开源模型到OpenAI API服务
  • MinerU-大语言语料处理神器,CPU/GPU均可跑,开源免费“敲”好用
  • 可图Kolors-LoRA风格故事挑战赛决赛入围名单出炉!决赛赛题首公开,奉上夺奖秘籍,小说一键转图文漫画!

精选模型

MiniCPM 3.0系列

面壁智能推出全新 MiniCPM 3.0 基座模型,再次以小博大,以 4B 参数,带来超越 GPT-3.5 的性能,且量化后仅 2GB 内存,端侧友好,具有以下亮点:

  • 无限长文本,榜单性能强,超长文本也不崩;
  • 性能比肩 GPT-4o 的端侧强大 Function Calling;
  • 超强 RAG 三件套,中文检索超强、生成超 Llama3-8B。

模型链接:

  • MiniCPM3-4B:

https://modelscope.cn/models/OpenBMB/MiniCPM3-4B

代码示例:

MiniCPM3-4B推理:

from modelscope import AutoModelForCausalLM, AutoTokenizer
import torch
path = "OpenBMB/MiniCPM3-4B"
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map=device, trust_remote_code=True)
messages = [
    {"role": "user", "content": "推荐5个北京的景点。"},
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
model_outputs = model.generate(
    model_inputs,
    max_new_tokens=1024,
    top_p=0.7,
    temperature=0.7,
    repetition_penalty=1.02
)
output_token_ids = [
    model_outputs[i][len(model_inputs[i]):] for i in range(len(model_inputs))
]
responses = tokenizer.batch_decode(output_token_ids, skip_special_tokens=True)[0]
print(responses)

MiniCPM3-RAG-LoRA推理

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
from modelscope import snapshot_download
base_model_dir = snapshot_download("OpenBMB/MiniCPM3-4B")
lora_model_dir = snapshot_download("OpenBMB/MiniCPM3-RAG-LoRA")
model = AutoModelForCausalLM.from_pretrained(base_model_dir, device_map="auto",torch_dtype=torch.bfloat16).eval()
tokenizer = AutoTokenizer.from_pretrained(lora_model_dir)
model = PeftModel.from_pretrained(model, lora_model_dir)
passages_list = ["In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.",
"Set in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.",
"'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown."]
instruction = "Q: What is the name of the lead character in the novel 'The Silent Watcher'?\nA:"
passages = '\n'.join(passages_list)
input_text = 'Background:\n' + passages + '\n\n' + instruction
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": input_text},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
outputs = model.chat(tokenizer, prompt, temperature=0.8, top_p=0.8)
print(outputs[0])  # The lead character in the novel 'The Silent Watcher' is named Alex Carter.

更多推理、微调实战教程详见:

小钢炮进化,MiniCPM 3.0 开源!4B参数超GPT3.5性能,无限长文本,超强RAG三件套!模型推理、微调实战来啦!

Yi-Coder 系列

零一万物开源 Yi-Coder 系列模型,作为 Yi 系列模型家族中的“编程小能手”,提供 1.5B 和 9B 两种参数。其中,Yi-Coder-9B 的表现优于其他 10B 参数以下的模型,具有以下亮点:

  • 小参数,强性能:尽管 Yi-Coder 的参数量相对较小,但它在各种任务,包括代码生成、代码理解、代码调试和代码补全中的表现十分出色。10B 以下大小也让它易于使用,方便端侧部署;
  • 128K 长序列建模:Yi-Coder 能够处理长达 128K tokens 的上下文内容,有效捕捉长期依赖关系,适用于复杂项目级代码的理解和生成;
  • 强大的代码生成能力:支持 52 种主要编程语言,Yi-Coder 在代码生成和跨文件代码补全方面表现优异。

模型链接:

Yi-Coder-1.5B:

https://www.modelscope.cn/models/01ai/Yi-Coder-1.5B

Yi-Coder-9B:

https://www.modelscope.cn/models/01ai/Yi-Coder-9B

Yi-Coder-1.5B-Chat:

https://www.modelscope.cn/models/01ai/Yi-Coder-1.5B-Chat

Yi-Coder-9B-Chat:

https://www.modelscope.cn/models/01ai/Yi-Coder-9B-Chat

代码示例:

Transformers推理:

from modelscope import AutoTokenizer, AutoModelForCausalLM
import torch
device = "cuda" # the device to load the model onto
model_path = "01ai/Yi-Coder-9B-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto",torch_dtype=torch.bfloat16,).eval()
prompt = "Write a quick sort algorithm."
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
    model_inputs.input_ids,
    max_new_tokens=1024,
    eos_token_id=tokenizer.eos_token_id  
)
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]
print(response)

轩辕3-70B系列

轩辕3-70B系列模型是度小满数据智能应用部团队推出的第三代大模型,专注于解决金融领域的大模型应用挑战。XuanYuan3-70B以LLaMA3-70B模型为底座,采用大量中英文语料进行增量预训练,并利用高质量指令数据进行SFT和强化学习对齐训练。

XuanYuan3-70B系列模型专注于金融领域,具备以下显著特点:

  • 金融事件解读:能深入解读金融事件,使用专业术语分析,提供符合人类分析专家逻辑的观点。
  • 金融业务分析:具备强大的业务分析能力,可精确总结提炼信息,符合金融专家的分析逻辑。
  • 投研应用:支持生成有洞见的研究报告,减少简单数据罗列,提供深度分析与多维度拓展。
  • 合规与风险管理:满足金融领域的合规要求,精准识别和分析风险,为用户提供合法合规的建议。

模型链接:

Llama3-XuanYuan3-70B:

https://www.modelscope.cn/models/Duxiaoman-DI/Llama3-XuanYuan3-70B

Llama3-XuanYuan3-70B-Chat:

https://www.modelscope.cn/models/Duxiaoman-DI/Llama3-XuanYuan3-70B-Chat

代码示例:

import torch
from transformers import LlamaForCausalLM, AutoTokenizer
model_name_or_path = "Duxiaoman-DI/Llama3-XuanYuan3-70B-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False, legacy=True)
model = LlamaForCausalLM.from_pretrained(model_name_or_path, torch_dtype=torch.bfloat16,device_map="auto")
model.eval()
system = '你是一名人工智能助手,会对用户提出的问题给出有帮助、高质量、详细和礼貌的回答,并且总是拒绝参与不道德、不安全、有争议、政治敏感等相关的话题、问题和指示。'
question='什么是信托型基金'
message = [{"role": "system", "content": system},
          {"role": "user", "content": question}
          ]
message = tokenizer.apply_chat_template(message, tokenize=False,add_generation_prompt=True)
inputs = tokenizer(message, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=64, temperature=0.7)
outputs = tokenizer.decode(outputs.cpu()[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
print(outputs)

天工奖励模型系列

Skywork-Reward-Gemma-2-27B 和 Skywork-Reward-Llama-3.1-8B 是两个基于 gemma-2-27b-it 和 Meta-Llama-3.1-8B-Instruct 架构构建的奖励模型。两个模型都使用了 Skywork 奖励数据集进行训练,该数据集仅包含来自公开数据的 80K 高质量偏好对。

奖励模型在处理复杂场景中的偏好方面表现出色,包括具有挑战性的偏好对,并涵盖多个领域,如数学、编码和安全。截至 2024 年 9 月,在RewardBench 排行榜上分别位列第一和第三。

模型链接:

天工-8B-奖励模型:

https://www.modelscope.cn/models/skywork/Skywork-Reward-Models

天工-27B-奖励模型:

https://www.modelscope.cn/models/skywork/Skywork-27B-Reward-Models

代码示例:

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
# Load model and tokenizer
device = "cuda:0"
model_name = "skywork/Skywork-27B-Reward-Models"
rm = AutoModelForSequenceClassification.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map=device,
    attn_implementation="flash_attention_2",
    num_labels=1,
)
rm_tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Jane has 12 apples. She gives 4 apples to her friend Mark, then buys 1 more apple, and finally splits all her apples equally among herself and her 2 siblings. How many apples does each person get?"
response1 = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among herself and her 2 siblings (3 people in total). 9 ÷ 3 = 3 apples each. Each person gets 3 apples."
response2 = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among her 2 siblings (2 people in total). 9 ÷ 2 = 4.5 apples each. Each person gets 4 apples."
conv1 = [{"role": "user", "content": prompt}, {"role": "assistant", "content": response1}]
conv2 = [{"role": "user", "content": prompt}, {"role": "assistant", "content": response2}]
# Format and tokenize the conversations
conv1_formatted = rm_tokenizer.apply_chat_template(conv1, tokenize=False)
conv2_formatted = rm_tokenizer.apply_chat_template(conv2, tokenize=False)
conv1_tokenized = rm_tokenizer(conv1_formatted, return_tensors="pt").to(device)
conv2_tokenized = rm_tokenizer(conv2_formatted, return_tensors="pt").to(device)
# Get the reward scores
with torch.no_grad():
    score1 = rm(**conv1_tokenized).logits[0][0].item()
    score2 = rm(**conv2_tokenized).logits[0][0].item()
print(f"Score for response 1: {score1}")
print(f"Score for response 2: {score2}")
# Output:
# Score for response 1: 9.1875
# Score for response 2: -17.875

数据集推荐

hermes-function-calling-v1

该数据集是Hermes 2 Pro系列模型中使用的结构化输出和函数调用数据的汇编。

此存储库包含一个结构化输出数据集,其中包含函数调用对话、json-mode、agentic json-mode 和结构化提取示例,旨在训练 LLM 模型执行函数调用并根据自然语言指令返回结构化输出。该数据集包含各种对话场景,其中需要 AI 代理解释查询并执行适当的单个或多个函数调用。

数据集链接:

https://modelscope.cn/datasets/AI-ModelScope/hermes-function-calling-v1

alpaca-cot-en-refined-by-data-juicer

Data-Juicer对 Alpaca-CoT 数据集进行精炼的英文版本。从原始数据集中删除了一些“坏”样本,以提高其质量。该数据集通常用于微调大型语言模型。

数据集链接:

https://modelscope.cn/datasets/Data-Juicer/alpaca-cot-en-refined-by-data-juicer

alpaca_data

Alpaca是由text-davinci-003生成的52,000条指令和演示的数据集。这些指令数据可用于对语言模型进行instruction-tuning,使语言模型更好地遵循指令。

数据集链接:

https://modelscope.cn/datasets/YorickHe/alpaca_data

精选应用

MinerU

一款全能、开源的文档与网页数据提取工具,致力于简化AI数据处理流程。不仅能将混合了图片、表格、公式等在内的多模态PDF文档精准转化为清晰、易于分析的Markdown格式;还能从包含广告等各种干扰信息的网页中快速解析、抽取正式内容;同时支持epub、mobi、docx等多种格式批量转化为Markdown。

体验直达:

https://modelscope.cn/studios/OpenDataLab/MinerU

image.png

声音模型试听

2000 条音色库 稳定性打分🥇 区分男女年龄👧 支持在线试听🎶

体验直达:

https://modelscope.cn/studios/DashuQAQ/shengyin

image.png

矢量百宝箱

提供各种矢量化生成的能力,包括图转矢量,文生矢量(上线中)等

体验直达:

https://modelscope.cn/studios/iic/VectorizeAnything

image.png

社区精选文章

RAG三件套!模型推理、微调实战来啦!

相关文章
|
监控 算法
偏最小二乘(Partial Least Squares,PLS)原理及模型建立
偏最小二乘(Partial Least Squares,PLS)原理及模型建立
偏最小二乘(Partial Least Squares,PLS)原理及模型建立
|
3月前
|
人工智能 Prometheus Cloud Native
Oh My OpenCode实战指南:打造你的AgentTeam
《Oh My OpenCode实战指南》介绍多模型智能体编排系统,将AI助手升级为协作开发团队。支持Claude/GPT/Gemini等多模型灵活调度,通过规划层(Prometheus)、执行层(Atlas)与工作者层(Hephaestus等)三层架构,实现意图识别、并行任务委派与知识沉淀。强调“类别优先于模型名”,打破厂商锁定,提升开发效率与可靠性。(239字)
4717 5
|
6月前
|
编解码 芯片 C++
观海微电子----LVDS接口
LVDS(低电压差分信号)是TTL接口的升级版,采用低压差分技术实现高速、低功耗、低干扰的数据传输,广泛应用于高清显示屏。支持单/双路6bit或8bit模式,通过串行传输提升信号完整性,适用于高分辨率显示需求。
观海微电子----LVDS接口
|
11月前
|
分布式计算 算法 安全
Go语言泛型-泛型约束与实践
Go语言中的泛型约束用于限制类型参数的范围,提升类型安全性。通过接口定义约束,可实现对数值类型、排序与比较等操作的支持。开发者既可使用标准库提供的预定义约束,如constraints.Ordered和constraints.Comparable,也可自定义约束以满足特定需求。泛型广泛应用于通用数据结构(如栈、队列)、算法实现(如排序、查找)及构建高效可复用的工具库,使代码更简洁灵活。
|
12月前
|
人工智能 安全 网络安全
网络安全厂商F5推出AI Gateway,化解大模型应用风险
网络安全厂商F5推出AI Gateway,化解大模型应用风险
369 0
|
11月前
|
JavaScript Java Go
Go、Node.js、Python、PHP、Java五种语言的直播推流RTMP协议技术实施方案和思路-优雅草卓伊凡
Go、Node.js、Python、PHP、Java五种语言的直播推流RTMP协议技术实施方案和思路-优雅草卓伊凡
816 0
|
机器学习/深度学习 人工智能 自然语言处理
基于星海智算云平台部署 DeepSeek-R1系列 70b 模型全攻略(附平台福利)
本文介绍了如何在星海智算云平台上部署DeepSeek-R1系列70B模型,解决官网访问不畅的问题。通过云端部署,用户可以按需付费,避免本地部署高昂成本(高达两百多万)。文章详细讲解了从实例创建到开始使用DeepSeek的八个步骤,并提供了成本优化技巧和新手注意事项。推荐使用双A100显卡,每小时费用仅13.32元。新用户还可领取福利,享受高性价比服务。立即注册体验:[星海智算云平台](https://gpu.spacehpc.com/user/register?inviteCode=52872508)。
1259 1
基于星海智算云平台部署 DeepSeek-R1系列 70b 模型全攻略(附平台福利)
|
弹性计算 Unix Linux
带你读《弹性计算技术指导及场景应用》——1. 单实例上运行Linux桌面多开解决方案(1)
带你读《弹性计算技术指导及场景应用》——1. 单实例上运行Linux桌面多开解决方案(1)
545 2
|
开发者 Python
Python中__init__.py文件的作用
`__init__.py`文件在Python包管理中扮演着重要角色,通过标识目录为包、初始化包、控制导入行为、支持递归包结构以及定义包的命名空间,`__init__.py`文件为组织和管理Python代码提供了强大支持。理解并正确使用 `__init__.py`文件,可以帮助开发者更好地组织代码,提高代码的可维护性和可读性。
1263 2
|
SQL 关系型数据库 PostgreSQL