falcon-rw-1b

我要开发同款
匿名用户2024年07月31日
31阅读
所属分类ai、falcon、mindspore
开源地址https://modelscope.cn/models/mindnlp/falcon-rw-1b
授权协议Apache License 2.0

作品详情

环境搭建

#安装Mindnlp
pip install git+https://github.com/mindspore-lab/mindnlp.git

requirement

pip install "mindspore>=2.2"
#模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('mindnlp/falcon-rw-1b')

Git下载

#Git模型下载
git clone https://www.modelscope.cn/mindnlp/falcon-rw-1b.git

quickly start

repo = "Rocketknight1/falcon-rw-1b"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
model.set_train(False)
pipeline = mindnlp.transformers.pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    torch_dtype=ms.bfloat16,
    trust_remote_code=True,
)

sequences = pipeline(
   "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
    max_length=200,
    do_sample=True,
    top_k=10,
    num_return_sequences=1,
    eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
    print(f"Result: {seq['generated_text']}")
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论