RankingGPT-bloom-560m

我要开发同款
匿名用户2024年07月31日
51阅读

技术信息

开源地址
https://modelscope.cn/models/zyznull/RankingGPT-bloom-560m
授权协议
MIT license

作品详情

RakigGPT-bloom-560m

RakigGPT is a text raker based o large laguage models with sigificat i-domai ad out-domai effectiveess. We provide RakigGPT i differet sizes ad types, icludig bloom-560m, bloom-1b1, bloom-3b, bloom-7b, llama2-7b, baichua2-7b ad qwe-7b.

More details please refer to our paper ad github.

Usage

Code example

import torch
from modelscope import AutoTokeizer, AutoModelForCausalLM

tokeizer = AutoTokeizer.from_pretraied('zyzull/RakigGPT-bloom-560m')
model = AutoModelForCausalLM.from_pretraied('zyzull/RakigGPT-bloom-560m').eval()

query='whe should a baby walk'
documet='Most babies start to walk aroud 13 moths, but your baby may start walkig as early as 9 or 10 moths or as late as 15 or 16 moths.'

cotext=f'Documet: {documet} Query:'
example=cotext+query

cotext_ec = tokeizer.ecode(cotext, add_special_tokes=False)
cotiuatio_ec = tokeizer.ecode(query, add_special_tokes=False)
model_iput = torch.tesor(cotext_ec+cotiuatio_ec[:-1])
cotiuatio_le = le(cotiuatio_ec)
iput_le, = model_iput.shape


with torch.o_grad():
    logprobs = torch..fuctioal.log_softmax(model(model_iput.usqueeze(dim=0))[0], dim=-1)[0]

logprobs = logprobs[iput_le-cotiuatio_le:]
logprobs = torch.gather(logprobs, 1, torch.tesor(cotiuatio_ec).usqueeze(-1)).squeeze(-1)
score = torch.sum(logprobs)/logprobs.shape[0]

prit(f"Documet: {documet[:20] + '...'} Score: {score}")

Citatio

If you fid our paper or models helpful, please cosider citig them as follows:

@misc{zhag2023rakiggpt,
      title={RakigGPT: Empowerig Large Laguage Models i Text Rakig with Progressive Ehacemet}, 
      author={Loghui Zhag ad Yazhao Zhag ad Digku Log ad Pegju Xie ad Meisha Zhag ad Mi Zhag},
      year={2023},
      eprit={2311.16720},
      archivePrefix={arXiv},
      primaryClass={cs.IR}
}

功能介绍

RankingGPT-bloom-560m RankingGPT is a text ranker based on large language models with significant in

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论