Views
No views yet
pszemraj/dolly_hhrlhf-text2text dataset.1# pip install -q transformers accelerate
2import torch
3from transformers import pipeline, GenerationConfig
4
5model_name = "pszemraj/bart-large-mnli-instruct-dolly_hhrlhf-v1"
6assistant = pipeline(
7 "text2text-generation",
8 model_name,
9 device_map="auto",
10)
11cfg = GenerationConfig.from_pretrained(model_name)
12
13# pass an 'instruction' as the prompt to the pipeline
14prompt = "Write a guide on how to become a ninja while working a 9-5 job."
15result = assistant(prompt, generation_config=cfg)[0]["generated_text"]
16print(result)The use of the generation config is optional, it can be replaced by other generation params.