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

本文涉及的产品
交互式建模 PAI-DSW,5000CU*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

相关文章
|
1月前
|
机器学习/深度学习 计算机视觉
顶会速递 | CVPR 2024 魔搭社区模型/创空间盘点(一)
魔搭社区整理了 CVPR 2024中稿论文中在社区上可下载的开源模型、体验Demo的一些工作,给大家带来第一波盘点
|
9月前
|
人工智能 自然语言处理 安全
国内首发,阿里云魔搭社区上架百川智能Baichuan 2系列模型
国内首发,阿里云魔搭社区上架百川智能Baichuan 2系列模型
927 0
|
1月前
|
人工智能 自然语言处理 开发者
书生·浦语2.0开源,阿里云魔搭首发
书生·浦语2.0开源,阿里云魔搭首发
89 0
|
7月前
|
数据可视化 测试技术 PyTorch
昆仑万维「天工」Skywork-13B魔搭社区首发开源!魔搭最佳实践来了!
作为国内最具诚意的开源百亿大模型,「天工」Skywork-13B系列无需申请即可实现商用,授权链路极简,且无用户数、行业、公司规模限制。
|
9月前
|
自然语言处理 测试技术 编译器
社区供稿 | 姜子牙大模型开源代码大模型Ziya-Coding-34B-v1.0 再创榜单新高,魔搭开源可体验!
使用自然语言生成高质量的代码是大模型落地中的高频需求。近日,IDEA研究院封神榜团队正式开源最新的代码大模型Ziya-Coding-34B-v1.0,我们在HumanEval Pass@1的评测上,取得了75.5的好成绩,超过了GPT-4(67.0)的得分,也成为目前已知开源模型新高。
|
1月前
|
人工智能 自然语言处理 算法
魔搭城市行 | 南京站 · 「阿里巴巴人工智能大模型&魔搭开源社区交流论坛」成功举办
2024年1月11日下午,阿里巴巴人工智能大模型及魔搭开源社区交流沙龙 · 南京站在南京软件谷云密城L栋成功举办!
|
6月前
|
人工智能 搜索推荐 物联网
文生视频黑马AnimateDiff 魔搭社区最佳实践教程来啦!
近1个月来,AnimateDiff 无疑是AI动画/视频生成领域的一匹黑马,以“效果丝滑、稳定、无闪烁”等好评斩获“Stable Diffusion封神插件”称号。
|
7月前
|
人工智能 算法 数据处理
零一万物发布首款大模型,阿里云魔搭社区开源首发
零一万物发布首款大模型,阿里云魔搭社区开源首发
236 0
|
9月前
|
人工智能 自然语言处理 安全
书生·浦语20B模型在阿里云魔搭开源首发!
书生·浦语20B模型在阿里云魔搭开源首发!
173 0
|
9月前
|
前端开发 程序员