Commit
·
6e8aaf9
1
Parent(s):
d873f9f
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import requests
|
|
10 |
#url = "https://github.com/simonepri/lm-scorer/tree/master/lm_scorer/models"
|
11 |
#resp = requests.get(url)
|
12 |
|
13 |
-
from sentence_transformers import SentenceTransformer, util
|
14 |
#from sentence_transformers import SentenceTransformer, util
|
15 |
#from sklearn.metrics.pairwise import cosine_similarity
|
16 |
#from lm_scorer.models.auto import AutoLMScorer as LMScorer
|
@@ -18,7 +18,7 @@ from sentence_transformers import SentenceTransformer, util
|
|
18 |
#from sklearn.metrics.pairwise import cosine_similarity
|
19 |
|
20 |
|
21 |
-
|
22 |
|
23 |
model_sts = SentenceTransformer('stsb-distilbert-base')
|
24 |
|
@@ -55,10 +55,10 @@ def get_sim(x):
|
|
55 |
|
56 |
model = GPT2LMHeadModel.from_pretrained('distilgpt2', output_hidden_states = True, output_attentions = True)
|
57 |
|
58 |
-
|
59 |
|
60 |
#model.eval()
|
61 |
-
|
62 |
|
63 |
tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
|
64 |
#tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
|
|
|
10 |
#url = "https://github.com/simonepri/lm-scorer/tree/master/lm_scorer/models"
|
11 |
#resp = requests.get(url)
|
12 |
|
13 |
+
#from sentence_transformers import SentenceTransformer, util
|
14 |
#from sentence_transformers import SentenceTransformer, util
|
15 |
#from sklearn.metrics.pairwise import cosine_similarity
|
16 |
#from lm_scorer.models.auto import AutoLMScorer as LMScorer
|
|
|
18 |
#from sklearn.metrics.pairwise import cosine_similarity
|
19 |
|
20 |
|
21 |
+
model_sts = gr.Interface.load('huggingface/sentence-transformers/stsb-distilbert-base')
|
22 |
|
23 |
model_sts = SentenceTransformer('stsb-distilbert-base')
|
24 |
|
|
|
55 |
|
56 |
model = GPT2LMHeadModel.from_pretrained('distilgpt2', output_hidden_states = True, output_attentions = True)
|
57 |
|
58 |
+
model = gr.Interface.load('huggingface/distilgpt2', output_hidden_states = True, output_attentions = True)
|
59 |
|
60 |
#model.eval()
|
61 |
+
tokenizer = gr.Interface.load('huggingface/distilgpt2')
|
62 |
|
63 |
tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
|
64 |
#tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')
|