guihu commited on
Commit
a163a9c
·
verified ·
1 Parent(s): 81087d2

Add verified text-to-graph input and output examples

Browse files
Files changed (1) hide show
  1. README.md +15 -2
README.md CHANGED
@@ -28,12 +28,25 @@ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
28
  model_path = "Loria-MosAIk/bt5-webnlg-en-ru"
29
  tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
30
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path).eval()
31
- inputs = tokenizer("Parse English Paris is located in France.", return_tensors="pt")
32
  outputs = model.generate(**inputs, num_beams=5, max_new_tokens=256)
33
  print(tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=False))
34
  ```
35
 
36
- Use `Parse Russian` for Russian input. Generated triples use `<S>`, `<P>`, and `<O>` markers. The accompanying reproduction code parses these markers and removes exact duplicate triples before evaluation.
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  The [base model](https://huggingface.co/cointegrated/rut5-base-multitask) is distributed under MIT. The WebNLG data used for fine-tuning are distributed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
39
 
 
28
  model_path = "Loria-MosAIk/bt5-webnlg-en-ru"
29
  tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
30
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path).eval()
31
+ inputs = tokenizer("Parse English Lina Dorado was born in Bogotá in 1975.", return_tensors="pt")
32
  outputs = model.generate(**inputs, num_beams=5, max_new_tokens=256)
33
  print(tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=False))
34
  ```
35
 
36
+ Output:
37
+
38
+ ```text
39
+ <S> Lina Dorado <P> birth year <O> 1975 <S> Lina Dorado <P> birth place <O> Bogotá
40
+ ```
41
+
42
+ For a Russian sentence, use the `Parse Russian` prefix:
43
+
44
+ ```text
45
+ Input: Parse Russian Валюта Индии - Индийская рупия.
46
+ Output: <S> India <P> currency <O> Indian rupee
47
+ ```
48
+
49
+ The markers `<S>`, `<P>`, and `<O>` identify the subject, relation, and object of each triple. The reproduction code removes exact duplicate triples before evaluation.
50
 
51
  The [base model](https://huggingface.co/cointegrated/rut5-base-multitask) is distributed under MIT. The WebNLG data used for fine-tuning are distributed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
52