fanxiao commited on
Commit
a58d18d
1 Parent(s): 720b49d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -0
README.md CHANGED
@@ -24,4 +24,10 @@ tokenizer_kwargs = {
24
 
25
  tokenizer = BertTokenizer.from_pretrained(model_name, **tokenizer_kwargs)
26
 
 
27
 
 
 
 
 
 
 
24
 
25
  tokenizer = BertTokenizer.from_pretrained(model_name, **tokenizer_kwargs)
26
 
27
+ model = BartForConditionalGeneration.from_pretrained('./CGRE_CNDBPedia-Generative-Relation-Extraction',local_files_only=True)
28
 
29
+ inputs = tokenizer(sent, max_length=max_source_length, padding="max_length", truncation=True, return_tensors="pt")
30
+
31
+ params = {"decoder_start_token_id":0,"early_stopping":False,"no_repeat_ngram_size":0,"length_penalty": 0,"num_beams":20,"use_cache":True}
32
+
33
+ out_id = model.generate(inputs["input_ids"], attention_mask = inputs["attention_mask"], max_length=max_target_length, **params)