Views
No views yet

PyTorch and the transformers library installed. You can then use the following code to generate text using the model:1import torch
2from transformers import GPT2Tokenizer, GPTNeoForCausalLM
3
4tokenizer = GPT2Tokenizer.from_pretrained("aksty/promptgen")
5model = GPTNeoForCausalLM.from_pretrained("aksty/promptgen")
6
7def generate_text(prompt):
8 input_ids = tokenizer(prompt, return_tensors="pt").input_ids
9 outputs = model.generate(input_ids, do_sample=True, max_length=100)
10 return tokenizer.batch_decode(outputs, skip_special_tokens=True)
11generate_text("A painting of an ancient city ")['A painting of an ancient city on the top of a cliff, a small sign charging through the sky, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski']