Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import os
|
|
| 5 |
import torch
|
| 6 |
import torch.nn as nn
|
| 7 |
from transformers.activations import get_activation
|
| 8 |
-
from transformers import AutoTokenizer,
|
| 9 |
|
| 10 |
|
| 11 |
st.title('GPT2:')
|
|
@@ -15,7 +15,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 15 |
@st.cache(allow_output_mutation=True)
|
| 16 |
def get_model():
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("BigSalmon/MASKGPT2")
|
| 18 |
-
model =
|
| 19 |
return model, tokenizer
|
| 20 |
|
| 21 |
model, tokenizer = get_model()
|
|
|
|
| 5 |
import torch
|
| 6 |
import torch.nn as nn
|
| 7 |
from transformers.activations import get_activation
|
| 8 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 9 |
|
| 10 |
|
| 11 |
st.title('GPT2:')
|
|
|
|
| 15 |
@st.cache(allow_output_mutation=True)
|
| 16 |
def get_model():
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("BigSalmon/MASKGPT2")
|
| 18 |
+
model = AutoModelForCausalLM.from_pretrained("BigSalmon/MASKGPT2")
|
| 19 |
return model, tokenizer
|
| 20 |
|
| 21 |
model, tokenizer = get_model()
|