pszemraj commited on
Commit
21c203b
β€’
1 Parent(s): 86215a1

πŸ” add auth token and experimental models

Browse files

Signed-off-by: peter szemraj <[email protected]>

Files changed (2) hide show
  1. app.py +3 -2
  2. summarize.py +6 -1
app.py CHANGED
@@ -64,8 +64,9 @@ nltk.download("popular", force=True, quiet=True)
64
  MODEL_OPTIONS = [
65
  "pszemraj/long-t5-tglobal-base-16384-book-summary",
66
  "pszemraj/long-t5-tglobal-base-sci-simplify",
67
- "pszemraj/long-t5-tglobal-base-sci-simplify-elife",
68
- "pszemraj/long-t5-tglobal-base-16384-booksci-summary-v1",
 
69
  "pszemraj/pegasus-x-large-book-summary",
70
  ] # models users can choose from
71
  BEAM_OPTIONS = [2, 3, 4] # beam sizes users can choose from
 
64
  MODEL_OPTIONS = [
65
  "pszemraj/long-t5-tglobal-base-16384-book-summary",
66
  "pszemraj/long-t5-tglobal-base-sci-simplify",
67
+ "pszemraj/long-t5-tglobal-base-summary-souffle-16384-loD",
68
+ "pszemraj/long-t5-tglobal-base-summary-souffle-16384-neftune_0.3",
69
+ "pszemraj/long-t5-tglobal-base-summary-souffle-16384-neftune_0.6",
70
  "pszemraj/pegasus-x-large-book-summary",
71
  ] # models users can choose from
72
  BEAM_OPTIONS = [2, 3, 4] # beam sizes users can choose from
summarize.py CHANGED
@@ -2,6 +2,7 @@
2
  summarize - a module for summarizing text using a model from the Hugging Face model hub
3
  """
4
  import logging
 
5
  import pprint as pp
6
 
7
  logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(message)s")
@@ -23,10 +24,14 @@ def load_model_and_tokenizer(model_name: str) -> tuple:
23
  device = "cuda" if torch.cuda.is_available() else "cpu"
24
  model = AutoModelForSeq2SeqLM.from_pretrained(
25
  model_name,
 
26
  ).to(device)
27
  model = model.eval()
28
 
29
- tokenizer = AutoTokenizer.from_pretrained(model_name)
 
 
 
30
 
31
  logging.info(f"Loaded model {model_name} to {device}")
32
 
 
2
  summarize - a module for summarizing text using a model from the Hugging Face model hub
3
  """
4
  import logging
5
+ import os
6
  import pprint as pp
7
 
8
  logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(message)s")
 
24
  device = "cuda" if torch.cuda.is_available() else "cpu"
25
  model = AutoModelForSeq2SeqLM.from_pretrained(
26
  model_name,
27
+ use_auth_token=os.environ.get("HF_TOKEN", None),
28
  ).to(device)
29
  model = model.eval()
30
 
31
+ tokenizer = AutoTokenizer.from_pretrained(
32
+ model_name,
33
+ use_auth_token=os.environ.get("HF_TOKEN", None),
34
+ )
35
 
36
  logging.info(f"Loaded model {model_name} to {device}")
37