BigSalmon commited on
Commit
1a8295f
1 Parent(s): 60a1dd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -6,8 +6,10 @@ import torch
6
  import torch.nn as nn
7
  from transformers.activations import get_activation
8
  from transformers import AutoTokenizer, AutoModelWithLMHead, AutoModelForCausalLM
 
9
  st.title('GPT2:')
10
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
11
  @st.cache(allow_output_mutation=True)
12
  def get_model():
13
  #model = #AutoModelWithLMHead.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln6")
@@ -24,7 +26,6 @@ def get_model():
24
  #model = AutoModelWithLMHead.from_pretrained("BigSalmon/InformalToFormalLincoln29")
25
  tokenizer = AutoTokenizer.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln")
26
  model = AutoModelForCausalLM.from_pretrained("BigSalmon/InformalToFormalLincoln30")
27
- model.to(device)
28
  return model, tokenizer
29
 
30
  model, tokenizer = get_model()
 
6
  import torch.nn as nn
7
  from transformers.activations import get_activation
8
  from transformers import AutoTokenizer, AutoModelWithLMHead, AutoModelForCausalLM
9
+
10
  st.title('GPT2:')
11
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
12
+
13
  @st.cache(allow_output_mutation=True)
14
  def get_model():
15
  #model = #AutoModelWithLMHead.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln6")
 
26
  #model = AutoModelWithLMHead.from_pretrained("BigSalmon/InformalToFormalLincoln29")
27
  tokenizer = AutoTokenizer.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln")
28
  model = AutoModelForCausalLM.from_pretrained("BigSalmon/InformalToFormalLincoln30")
 
29
  return model, tokenizer
30
 
31
  model, tokenizer = get_model()