Views
No views yet
flan-t5-xl fine-tuned on the KELM Corpus to take in sentences and output triplets of the form subject-relation-object to be used for knowledge graph generation.special_tokens = ['<triplet>', '</triplet>', '<relation>', '<object>']
tokenizer.add_tokens(special_tokens)model = model.to(device)
model.eval()
new_input = "Hugging Face, Inc. is an American company that develops tools for building applications using machine learning.",
inputs = tokenizer(new_input, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"))
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=False)[0])<pad><triplet> Hugging Face <relation> instance of <object> Business </triplet></s>