File size: 2,814 Bytes
09390f7
 
 
 
ee913f2
9e8df1b
ee913f2
 
09390f7
 
 
9bed08f
 
 
 
 
 
 
 
 
 
4df1d15
9bed08f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e8df1b
9bed08f
 
 
 
 
 
 
 
 
 
 
 
8cf01c9
9bed08f
 
 
 
 
 
 
 
 
09390f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
license: apache-2.0
language:
- en
pipeline_tag: summarization
widget:
- text: What is an LSTM?
  example_title: Question Answering
tags:
- arxiv
---
#  Table of Contents

0. [TL;DR](#TL;DR)
1. [Model Details](#model-details)
2. [Usage](#usage)
3. [Uses](#uses)
4. [Citation](#citation)

# TL;DR

This is a FLAN-T5 model trained on [ArtifactAI/arxiv-cs-ml-instruct-tune-50k](https://huggingface.co/datasets/ArtifactAI/arxiv-cs-ml-instruct-tune-50k). This model is for research purposes only and ***should not be used in production settings***. The output is highly unreliable.

# Model Details

## Model Description


- **Model type:** Language model
- **Language(s) (NLP):** English
- **License:** Apache 2.0
- **Related Models:** [All FLAN-T5 Checkpoints](https://huggingface.co/models?search=flan-t5)

# Usage

Find below some example scripts on how to use the model in `transformers`:

## Using the Pytorch model

### Running the model on a CPU


```python

from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained("ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering")
model = T5ForConditionalGeneration.from_pretrained("ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering")

input_text = "What is an LSTM?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
```


### Running the model on a GPU


```python
# pip install accelerate
from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained("ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering")
model = T5ForConditionalGeneration.from_pretrained("ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering", device_map="auto")

input_text = "What is an LSTM?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
```


### Running the model in an HF pipeline

#### FP16


```python
# load model and tokenizer from huggingface hub with pipeline
qa = pipeline("summarization", model="ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering")


query = "What is an LSTM?"
print(f"query: {query}")
res = qa("answer: " + query)

print(f"{res[0]['summary_text']}")

```


# Training Details

## Training Data

The model was trained on [ArtifactAI/arxiv-cs-ml-instruct-tune-50k](https://huggingface.co/datasets/ArtifactAI/arxiv-cs-ml-instruct-tune-50k), a dataset of question/answer pairs. Questions are generated using the t5-base model, while the answers are generated using the GPT-3.5-turbo model.

# Citation

```
@misc{flan-t5-base-arxiv-cs-ml-question-answering,
    title={flan-t5-base-arxiv-cs-ml-question-answering},
    author={Matthew Kenney},
    year={2023}
}
```