facebook OPT试用

在GoogleColab环境中,使用transformers库分别试用了OPT-350m和OPT-1.3b模型进行文本生成。通过设置do_sample参数为True并指定num_return_sequences为5,观察了两个模型对‘pleaseintroduceyourself’的响应。结果显示,1.3b模型的生成结果更丰富和连贯,比350m模型表现更好。但由于内存限制,无法在Colab上加载更大的模型。
摘要由CSDN通过智能技术生成

本次试用是在colab环境下完成的
首先,安装相关包

!pip install transformers

其次,试用模型350m

from transformers import pipeline
generator = pipeline('text-generation', model="facebook/opt-350m", do_sample=True, num_return_sequences=5)
generator("please introduce yourself")

返回结果如下:

[{'generated_text': 'please introduce yourself - what is your favorite book?'},
 {'generated_text': "please introduce yourself to our members.\n\nWhat's your name, and where from, and how"},
 {'generated_text': 'please introduce yourself\n\nhello,\ni am actually about to do a major in psychology, i'},
 {'generated_text': 'please introduce yourself!\nHey there! What kind of music are you trying to make?\nI'},
 {'generated_text': "please introduce yourself\nIt's me, Mike! I made my own reddit"}]

可能是试用的模型比较小,跟chatgpt的长篇大论的问答比,还是稍微弱了点

最后,试用模型1.3b

from transformers import pipeline
generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True, num_return_sequences=5)
generator("please introduce yourself")

返回结果如下:

[{'generated_text': "please introduce yourself to me in the back, i can't believe i forgot to do the little welcome"},
 {'generated_text': "please introduce yourself\nI'm the guy! Glad to see someone recognizes my username. :)\nwhat"},
 {'generated_text': 'please introduce yourself and give us some more info about yourself!\nThe girl in this picture is a'},
 {'generated_text': "please introduce yourself as a mod in this thread.\nI'm not a mod.  However I"},
 {'generated_text': 'please introduce yourself.\nWhat is up!? I am a huge fan of the show, I started'}]

从返回结果上看,1.3b的模型比350m的要好很多,不过因为ram限制,再大的模型已经无法在colab里加载了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值