mrm8488 commited on
Commit
bf2ba61
1 Parent(s): 5e465b4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -0
README.md CHANGED
@@ -87,6 +87,19 @@ MODEL_CKPT = 'mrm8488/t5-base-iterater'
87
  tokenizer = T5TokenizerFast.from_pretrained(MODEL_CKPT)
88
  model = T5ForConditionalGeneration.from_pretrained(MODEL_CKPT)
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  ```
91
 
92
  ### Framework versions
 
87
  tokenizer = T5TokenizerFast.from_pretrained(MODEL_CKPT)
88
  model = T5ForConditionalGeneration.from_pretrained(MODEL_CKPT)
89
 
90
+ def predict(intent, text):
91
+ input_text = f"<{intent}> {text}"
92
+ features = tokenizer([input_text], return_tensors='pt')
93
+ output = model.generate(input_ids=features['input_ids'],
94
+ attention_mask=features['attention_mask'], max_length=128, num_beams=8)
95
+ return tokenizer.decode(output[0], skip_special_tokens=True)
96
+
97
+ text = "Delay-based schemes have the potential to resolve this last packet problem by scheduling the link based on the delay for the packet has encountered."
98
+ intent = "clarity"
99
+
100
+ predict(intent, text)
101
+ # Delay-based schemes have the potential to resolve this last packet problem by scheduling the link based on the delay the packet has encountered.
102
+
103
  ```
104
 
105
  ### Framework versions