akoksal commited on
Commit
2649f69
1 Parent(s): 0b718d9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -0
README.md CHANGED
@@ -53,6 +53,24 @@ LongForm-**T5-XL**: https://huggingface.co/akoksal/LongForm-T5-XL
53
 
54
  LongForm-**OPT-6.7B**: https://huggingface.co/akoksal/LongForm-OPT-6.7B
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  ## Evaluation
58
  We provide in-depth evaluation of LongForm models and baselines in the paper. We present the METEOR scores of models in out-of-domain datasets. In all tasks, Recipe Generation (RGen), long-form question answering (ELI5), short story generation (WritingPrompts/WP), LongForm models outperform prior instruction-tuned models.
 
53
 
54
  LongForm-**OPT-6.7B**: https://huggingface.co/akoksal/LongForm-OPT-6.7B
55
 
56
+ ## How to Load
57
+ ```python
58
+ import torch
59
+ from transformers import AutoTokenizer, AutoModelForCausalLM
60
+ model = AutoModelForCausalLM.from_pretrained("akoksal/LongForm-OPT-2.7B")
61
+ tokenizer = AutoTokenizer.from_pretrained("akoksal/LongForm-OPT-2.7B")
62
+
63
+ instruction = "Write an essay about meditation. [EOI]"
64
+ torch.manual_seed(42)
65
+ input_ids = tokenizer(instruction, return_tensors="pt").input_ids
66
+ target_ids = model.generate(input_ids, do_sample=True, max_new_tokens=50, top_p=0.9)
67
+ tokenizer.decode(target_ids[0])
68
+ # Output:
69
+ # > </s>Write an essay about meditation. [EOI]Do you need some inspiration to\
70
+ # meditate? Do you know someone who is a great meditator but you aren't sure\
71
+ # what to say to them? This might be the perfect opportunity to tell them.\
72
+ # The ability to listen and learn and grow can
73
+ ```
74
 
75
  ## Evaluation
76
  We provide in-depth evaluation of LongForm models and baselines in the paper. We present the METEOR scores of models in out-of-domain datasets. In all tasks, Recipe Generation (RGen), long-form question answering (ELI5), short story generation (WritingPrompts/WP), LongForm models outperform prior instruction-tuned models.