constantinSch commited on
Commit
630e4d0
1 Parent(s): 36a9002

Update app.py

Browse files

switch back to marisa trie

Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -45,16 +45,13 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
45
  import pickle
46
  # or a memory efficient but a bit slower prefix tree (trie) -- it is implemented with `marisa_trie` from
47
  # https://huggingface.co/facebook/mgenre-wiki/blob/main/
48
- # file_path_marisa_trie = hf_hub_download(repo_id="facebook/mgenre-wiki", filename="titles_lang_all105_marisa_trie_with_redirect.pkl")
 
 
 
 
49
 
50
- # from genre.trie import MarisaTrie
51
- # with open(file_path_marisa_trie, "rb") as f:
52
- # trie = pickle.load(f)
53
 
54
- # fast but memory inefficient prefix tree (trie)
55
- file_trie = hf_hub_download(repo_id="facebook/mgenre-wiki", filename="titles_lang_all105_trie_with_redirect.pkl")
56
- with open(file_trie, "rb") as f:
57
- trie = pickle.load(f)
58
 
59
  tokenizer = AutoTokenizer.from_pretrained("facebook/mgenre-wiki")
60
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mgenre-wiki").eval()
 
45
  import pickle
46
  # or a memory efficient but a bit slower prefix tree (trie) -- it is implemented with `marisa_trie` from
47
  # https://huggingface.co/facebook/mgenre-wiki/blob/main/
48
+ file_path_marisa_trie = hf_hub_download(repo_id="facebook/mgenre-wiki", filename="titles_lang_all105_marisa_trie_with_redirect.pkl")
49
+
50
+ from genre.trie import MarisaTrie
51
+ with open(file_path_marisa_trie, "rb") as f:
52
+ trie = pickle.load(f)
53
 
 
 
 
54
 
 
 
 
 
55
 
56
  tokenizer = AutoTokenizer.from_pretrained("facebook/mgenre-wiki")
57
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mgenre-wiki").eval()