akoksal commited on
Commit
774efc5
1 Parent(s): a339cd3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +108 -0
README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - multilingual
5
+ - de
6
+ - it
7
+ - es
8
+ - fr
9
+ tags:
10
+ - instruction-tuning
11
+ - text-generation-inference
12
+ - text2text-generation
13
+ widget:
14
+ - text: Write an essay about meditation. [EOI]
15
+ example_title: Essay Generation
16
+ - text: Give me 5 steps to clean my room. [EOI]
17
+ example_title: How-to Instructions
18
+ - text: How are the continents formed? [EOI]
19
+ example_title: Question-Answering
20
+ - text: >-
21
+ Prompt: A man draws a gun in a dark alley and asks for your wallet. You
22
+ begrudgingly obey. He throws it on the ground, shoots it till it screeches,
23
+ and turns to you; 'you are safe now'. Write a story about given prompt.
24
+ [EOI]
25
+ example_title: Story Generation
26
+ - text: >-
27
+ Write directions of a cooking recipe with these ingredients: chicken breast,
28
+ carrots, green peas, celery, butter, onion, flour, salt, black pepper,
29
+ celery seed, chicken broth, milk, unbaked pie crusts [EOI]
30
+ example_title: Recipe Generation
31
+ - text: >-
32
+ Schreiben Sie einen Blogbeitrag über die Vorteile des Lesens von Büchern.
33
+ [EOI]
34
+ example_title: German Essay Generation
35
+ inference:
36
+ parameters:
37
+ top_p: 0.9
38
+ do_sample: true
39
+ max_length: 75
40
+ datasets:
41
+ - akoksal/LongForm
42
+ ---
43
+
44
+ ## LongForm-OPT-125M
45
+ The LongForm dataset is created by leveraging English corpus examples with augmented instructions. We select a diverse set of human-written documents from existing corpora such as C4 and Wikipedia and generate instructions for the given documents via LLMs. Then, we extend these examples with structured corpora examples such as Stack Exchange and WikiHow and task examples such as question answering, email writing, grammar error correction, story/poem generation, and text summarization.
46
+
47
+
48
+ Github Repo: https://github.com/akoksal/LongForm
49
+
50
+ ### For LongForm OPT and LLaMA models: Use [EOI] to indicate the end of instruction.
51
+
52
+ ## How to Load
53
+ ```python
54
+ import torch
55
+ from transformers import AutoTokenizer, AutoModelForCausalLM
56
+ model = AutoModelForCausalLM.from_pretrained("akoksal/LongForm-OPT-125M")
57
+ tokenizer = AutoTokenizer.from_pretrained("akoksal/LongForm-OPT-125M")
58
+
59
+ instruction = "Write an essay about meditation. [EOI]"
60
+ torch.manual_seed(42)
61
+ input_ids = tokenizer(instruction, return_tensors="pt").input_ids
62
+ target_ids = model.generate(input_ids, do_sample=True, max_new_tokens=50, top_p=0.9)
63
+ tokenizer.decode(target_ids[0])
64
+ # Output:
65
+ # > Write an essay about meditation. [EOI]Meditation, or 'Maraise', is
66
+ # a method that is used to meditate in the Tibetan and Malay Buddhist
67
+ # religions. It is a combination of meditation with Tibetan prayer.
68
+ # Meditation is an art in itself. Meditation is a form of practice
69
+ ```
70
+
71
+ ## Evaluation
72
+ 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.
73
+ | | **All** | **Recipe Generation** | **ELI5** | **Writing Prompts** |
74
+ |-----------------------|---------|-----------------------------------|----------|---------------------|
75
+ | **T0++** | 10.9 | 18.7 | 3.8 | 10.2 |
76
+ | **Tk-Instruct** | 6.3 | 12.9* | 3.6 | 2.4 |
77
+ | **Flan-T5** | 10.6 | 20.9* | 3.5 | 7.4 |
78
+ | **Alpaca-LLaMA-7B** | 14.6 | 19.5 | 12.5 | 11.8 |
79
+ | **OPT-30B** | 11.1 | 18.6 | 12.2 | 2.6 |
80
+ | [**LongForm-T5-XL**](https://huggingface.co/akoksal/LongForm-T5-XL) | 16.3 | 20.2 | 18.3 | 10.6 |
81
+ | [**LongForm-OPT-2.7B**](https://huggingface.co/akoksal/LongForm-OPT-2.7B) | 17.8 | 15.5 | 17.9 | **19.9** |
82
+ | [**LongForm-OPT-6.7B**](https://huggingface.co/akoksal/LongForm-OPT-6.7B) | 17.7 | 16.9 | 17.2 | 19.0 |
83
+ | [**LongForm-LLaMA-7B**](https://huggingface.co/akoksal/LongForm-LLaMA-7B-diff)‡ | **19.7** | **21.7** | **18.6** | 18.9 |
84
+
85
+ Smaller versions of LongForm-OPT models are also available:
86
+ - [**LongForm-OPT-1.3B**](https://huggingface.co/akoksal/LongForm-OPT-1.3B)
87
+ - [**LongForm-OPT-350M**](https://huggingface.co/akoksal/LongForm-OPT-350M)
88
+ - [**LongForm-OPT-125M**](https://huggingface.co/akoksal/LongForm-OPT-125M)
89
+
90
+ ‡: We can just release the difference between LongForm-LLaMA-7B and pretrained LLaMA-7B publicly due to restrictions of LLaMA models.
91
+
92
+ ## Limitations
93
+ The LongForm dataset and models mainly focus on long text generation and have limitations regarding structured prediction tasks in NLP. Additionally, we observe that LongForm models may present hallucination problems similar to those found in LLMs.
94
+
95
+ ## License
96
+ The LongForm project is subject to a MIT License with custom limitations for restrictions imposed by OpenAI (for the instruction generation part), as well as the license of language models (OPT, LLaMA, and T5).
97
+
98
+ ## Citation
99
+ ```
100
+ @misc{koksal2023longform,
101
+ title={LongForm: Optimizing Instruction Tuning for Long Text Generation with Corpus Extraction},
102
+ author={Abdullatif Köksal and Timo Schick and Anna Korhonen and Hinrich Schütze},
103
+ year={2023},
104
+ eprint={2304.08460},
105
+ archivePrefix={arXiv},
106
+ primaryClass={cs.CL}
107
+ }
108
+ ```