Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import numpy as np
|
|
8 |
import itertools
|
9 |
import tokenizers
|
10 |
|
11 |
-
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, AutoModelForMaskedLM:lambda _: None})
|
12 |
def load_bert():
|
13 |
return (AutoModelForMaskedLM.from_pretrained("vives/distilbert-base-uncased-finetuned-cvent-2019_2022", output_hidden_states=True),
|
14 |
AutoTokenizer.from_pretrained("vives/distilbert-base-uncased-finetuned-cvent-2019_2022"))
|
@@ -17,7 +17,7 @@ model, tokenizer = load_bert()
|
|
17 |
kp_dict_checkpoint = "kp_dict_merged.pickle"
|
18 |
kp_cosine_checkpoint = "cosine_kp.pickle"
|
19 |
|
20 |
-
@st.cache
|
21 |
def load_finbert():
|
22 |
return (AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert", output_hidden_states=True),
|
23 |
AutoTokenizer.from_pretrained("ProsusAI/finbert"))
|
@@ -26,7 +26,7 @@ model_finbert, tokenizer_finbert = load_finbert()
|
|
26 |
kp_dict_finbert_checkpoint = "kp_dict_finance.pickle"
|
27 |
kp_cosine_finbert_checkpoint = "cosine_kp_finance.pickle"
|
28 |
|
29 |
-
@st.cache
|
30 |
def load_sapbert():
|
31 |
return (AutoModel.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext", output_hidden_states=True),
|
32 |
AutoTokenizer.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext"))
|
|
|
8 |
import itertools
|
9 |
import tokenizers
|
10 |
|
11 |
+
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, AutoModelForMaskedLM: lambda _: None})
|
12 |
def load_bert():
|
13 |
return (AutoModelForMaskedLM.from_pretrained("vives/distilbert-base-uncased-finetuned-cvent-2019_2022", output_hidden_states=True),
|
14 |
AutoTokenizer.from_pretrained("vives/distilbert-base-uncased-finetuned-cvent-2019_2022"))
|
|
|
17 |
kp_dict_checkpoint = "kp_dict_merged.pickle"
|
18 |
kp_cosine_checkpoint = "cosine_kp.pickle"
|
19 |
|
20 |
+
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, AutoModelForSequenceClassification: lambda _: None})
|
21 |
def load_finbert():
|
22 |
return (AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert", output_hidden_states=True),
|
23 |
AutoTokenizer.from_pretrained("ProsusAI/finbert"))
|
|
|
26 |
kp_dict_finbert_checkpoint = "kp_dict_finance.pickle"
|
27 |
kp_cosine_finbert_checkpoint = "cosine_kp_finance.pickle"
|
28 |
|
29 |
+
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, AutoModel: lambda _: None})
|
30 |
def load_sapbert():
|
31 |
return (AutoModel.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext", output_hidden_states=True),
|
32 |
AutoTokenizer.from_pretrained("cambridgeltl/SapBERT-from-PubMedBERT-fulltext"))
|