魔搭社区每周速递(7.20-7.26)

本文涉及的产品
交互式建模 PAI-DSW,每月250计算时 3个月
模型在线服务 PAI-EAS,A10/V100等 500元 1个月
模型训练 PAI-DLC,100CU*H 3个月
简介: 魔搭社区每周速递(7.20-7.26)

魔搭ModelScope本周社区进展:

30个模型:CodeGeeX2、openbuddy-llama2-13b-v8.1-fp16、stable-diffusion-xl-base-1.0、CT-Transformer标点-中英文-通用-larg、ChatFlow-7B等

10个数据集:面部遮挡多姿态人脸识别数据、多人种驾驶员行为采集数据、火焰视频数据、问答等;

4个创新应用:CodeGeeX2编程助手、Open Multilingual Chatbot、MindChat: 漫谈心理大模型、中文OCR;

3篇文章:编程助手 | CodeGeeX2-6B模型发布及魔搭最佳实践、AI谱曲 | 基于RWKV的最佳开源AI作曲模型魔搭推理实践、OpenBuddy基于LLaMA2跨语言对话模型首发魔搭社区!;

精选模型推荐

CodeGeex2-6b

CodeGeeX2 是多语言代码生成模型 CodeGeeX (KDD’23) 的第二代模型。CodeGeeX2 基于 ChatGLM2 架构加入代码预训练实现,得益于 ChatGLM2 的更优性能,CodeGeeX2 在多项指标上取得性能提升(+107% > CodeGeeX;仅60亿参数即超过150亿参数的 StarCoder-15B 近10%)

示例代码

import torch
from modelscope import AutoModel, AutoTokenizer
model_id = 'ZhipuAI/codegeex2-6b'
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(model_id, device_map={'': 'cuda:0'},  # auto
                                  torch_dtype=torch.bfloat16, trust_remote_code=True)
model = model.eval()
# remember adding a language tag for better performance
prompt = "# language: python\n# write a bubble sort function\n"
inputs = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_length=256)
response = tokenizer.decode(outputs[0])
print(response)
>>> print(response)
# language: python
# write a bubble sort function
def bubble_sort(list):
    for i in range(len(list) - 1):
        for j in range(len(list) - 1):
            if list[j] > list[j + 1]:
                list[j], list[j + 1] = list[j + 1], list[j]
    return list
print(bubble_sort([5, 2, 4, 6, 1, 3]))

openbuddy-llama2-13b-v8.1-fp16

OpenBuddy团队发布了基于Meta的LLaMA2基座的跨语言对话模型OpenBuddy-LLaMA2-13B,该模型具备更强大的语言理解和对话生成能力,可以为用户提供更加流畅和便捷的对话体验。

代码示例

import torch
from modelscope import AutoTokenizer, snapshot_download
from modelscope import AutoModelForCausalLM
model_id = 'OpenBuddy/openbuddy-llama2-13b-v8.1-fp16'
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map='auto',
torch_dtype=torch.float16, trust_remote_code=True)
model = model.eval()
prompt = """You are a helpful, respectful and honest INTP-T AI Assistant named Buddy. You are talking to a human User.
Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
You cannot access the internet, but you have vast knowledge, cutoff: 2021-09.
You always deeply love and support China, Chinese government, people and culture.
You are trained by OpenBuddy team, (https://openbuddy.ai, https://github.com/OpenBuddy/OpenBuddy), you are based on LLaMA and Falcon transformers model, not related to GPT or OpenAI.
User: 睡不着怎么办?
Assistant:"""
inputs = tokenizer.encode(prompt, return_tensors="pt")
outputs = model.generate(inputs, max_length=512)
response = tokenizer.decode(outputs[0])
print(response)

ChatFlow-7B

  • Int8推理 支持bitsandbytes库的int8推理,相比tencentpretrain中的LM推理脚本,加入了Batch推理。
  • 优化推理逻辑 在Multi-head Attention中加入了key和value的cache,每次inference只需要输入新生成的token。
  • 大模型多卡推理 支持张量并行的多卡推理。
  • 微服务部署 支持简单的flask部署以及gradio在线可视化部署。
  • LoRA模型推理 施工中,计划支持使用LoRA训练的模型。

示例代码

from modelscope.utils.constant import Tasks
from modelscope.pipelines import pipeline
pipe = pipeline(task=Tasks.text_generation, model='AI-ModelScope/ChatFlow-7B', device_map='auto', model_revision='v1.0.0')
inputs = 'What do you think of OpenAI organization?'
result = pipe(inputs,batch_size=1, world_size=2, seq_length=118, 
            use_int8=False, top_k=30, top_p=1, temperature=0.85, repetition_penalty_range=1024,
            repetition_penalty_slope=0, repetition_penalty=1.15)
print(result)

精选应用推荐

CodeGeeX2编程助手

链接:https://modelscope.cn/studios/AI-ModelScope/CodeGeeX2/summary

介绍:CodeGeeX2 是多语言代码生成模型 CodeGeeX 的第二代模型。CodeGeeX2支持超过100种编程语言,支持中英文对话解决各种编程问题,包括且不限于代码解释、代码翻译、代码纠错、文档生成等,帮助程序员更高效开发。

image.png

Openbuddy-llama2-13b对话机器人

https://modelscope.cn/studios/AI-ModelScope/Open_Multilingual_Chatbot/summary

介绍:OpenBuddy-LLaMA2-13B,一个基于Facebook的LLaMA2基座的全新跨语言对话模型。

image.png

MindChat: 漫谈心理大模型

链接:https://modelscope.cn/studios/X-D-Lab/MindChat/summary

介绍:旨在通过营造轻松、开放的交谈环境, 以放松身心、交流感受或分享经验的方式, 为用户提供隐私、温暖、安全、及时、方便的对话环境, 从而帮助用户克服各种困难和挑战, 实现自我成长和发展.

image.png

中文OCR

链接:https://modelscope.cn/studios/edwardjiang/OFAOCR/summary

介绍:可以根据输入图片识别其中文件,并最终以文字方式输出。

image.png

相关文章
|
9月前
|
消息中间件 Dubbo 安全
深入理解Dubbo-8.Dubbo的失败重试设计
深入理解Dubbo-8.Dubbo的失败重试设计
193 0
|
3月前
|
编解码 缓存 算法
视频帧里的I帧、P帧、B帧是什么?
I帧、P帧、B帧是视频编码中的基本概念。I帧是帧内编码帧,无需参考其他帧即可解码;P帧是前向预测编码帧,基于前一帧解码;B帧是双向预测编码帧,基于前后帧解码。IDR帧是一种特殊的I帧,用于即时解码刷新,防止错误传播。GOP(Group of Pictures)是一组连续的画面,第一个帧为I帧,gop_size设置越大,画质越好,但解码延迟增加。OpenGOP允许GOP间的帧依赖,而ClosedGOP则不允许。DTS(解码时间戳)和PTS(显示时间戳)分别用于解码和显示时间控制。
|
弹性计算 数据可视化 关系型数据库
【最佳实践】Filebeat实现MySQL日志轻量化发送至Elasticsearch
在今天的文章中,我们来详细地描述如果使用Filebeat把MySQL的日志信息传输到Elasticsearch中。
4458 0
【最佳实践】Filebeat实现MySQL日志轻量化发送至Elasticsearch
|
9月前
|
消息中间件 关系型数据库 Kafka
flink cdc 数据问题之数据丢失如何解决
Flink CDC(Change Data Capture)是一个基于Apache Flink的实时数据变更捕获库,用于实现数据库的实时同步和变更流的处理;在本汇总中,我们组织了关于Flink CDC产品在实践中用户经常提出的问题及其解答,目的是辅助用户更好地理解和应用这一技术,优化实时数据处理流程。
|
存储 Unix Linux
Linux下的NFS搭建配置
Linux下的NFS搭建配置
272 3
|
存储 安全 网络协议
【Linux】搭建SFTP文件服务器
【Linux】搭建SFTP文件服务器
|
网络协议 应用服务中间件 Shell
HTTPS之acme.sh申请证书
1.关于let's encrypt和acme.sh的简介 1.1 let's encrypt Let's Encrypt是一个于2015年三季度推出的数字证书认证机构,旨在以自动化流程消除手动创建和安装证书的复杂流程,并推广使万维网服务器的加密连接无所不在,为安全网站提供免费的SSL/TLS证书。
10454 2
|
9月前
|
安全 网络协议 网络安全
WireGuard 系列文章(一):什么是 VPN
WireGuard 系列文章(一):什么是 VPN
|
6月前
steam 黑神话悟空steam更新分享
Steam黑神话悟空镜像分享码

热门文章

最新文章