beyond commited on
Commit
9799eb8
1 Parent(s): 31c11cf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -1
README.md CHANGED
@@ -52,4 +52,14 @@ sketch = "your_sketch"
52
  generated_text = genius(sketch, num_beams=3, do_sample=True, max_length=200)[0]['generated_text']
53
  print(generated_text)
54
  ```
55
- (it seems there are something wrong with Huggingface's markdown parser. I'm not able to type "\<mask\>" in the code block. Therefore, place replace the `sketch = "your_sketch"` with your own code, using `<mask>` to join some key words/phrases/sents)
 
 
 
 
 
 
 
 
 
 
 
52
  generated_text = genius(sketch, num_beams=3, do_sample=True, max_length=200)[0]['generated_text']
53
  print(generated_text)
54
  ```
55
+
56
+ ```
57
+ from transformers import pipeline
58
+ # 1. load the model with the huggingface `pipeline`
59
+ genius = pipeline("text2text-generation", model='beyond/genius-large', device=0)
60
+ # 2. provide a sketch (joint by <mask> tokens)
61
+ sketch = "<mask> Conference on Empirical Methods <mask> submission of research papers <mask> Deep Learning <mask>"
62
+ # 3. here we go!
63
+ generated_text = genius(sketch, num_beams=3, do_sample=True, max_length=200)[0]['generated_text']
64
+ print(generated_text)
65
+ ```