odia-gpt2-small / README.md
tripathysagar's picture
Update README.md
9a113d0 verified
|
raw
history blame
736 Bytes
metadata
license: apache-2.0
from transformers import pipeline, GPT2Tokenizer, GPT2LMHeadModel, PreTrainedTokenizerFast
checkpoint = "tripathysagar/oida-gpt"

model = GPT2LMHeadModel.from_pretrained(checkpoint)
tokenizer = PreTrainedTokenizerFast.from_pretrained(checkpoint)

generator = pipeline('text-generation', model=model, tokenizer=tokenizer, device=device)

raw_inputs = [
    "ଉଭୟ ଘଟଣାରେ ପରିବାର ଲୋକ",
    "ଅଫିସ ସମୟ ପରେ କୌଣସି ଉପରିସ୍ଥ",
]
inputs = tokenizer(raw_inputs, padding=True, truncation=True, return_tensors="pt")
print(inputs)
output = generator(raw_inputs, max_length=75, num_return_sequences=1, truncation=True)
print(output)