Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,7 @@ tokenizer = AutoTokenizer.from_pretrained('allenai/specter2_aug2023refresh_base'
|
|
88 |
model = AutoAdapterModel.from_pretrained('allenai/specter2_aug2023refresh_base')
|
89 |
|
90 |
|
91 |
-
|
92 |
def create_embeddings(texts_to_embedd):
|
93 |
# Set up the device
|
94 |
|
@@ -106,7 +106,7 @@ def create_embeddings(texts_to_embedd):
|
|
106 |
for i in range(0, len(data), batch_size):
|
107 |
yield data[i:i + batch_size]
|
108 |
|
109 |
-
|
110 |
def encode_texts(texts, device, batch_size=16):
|
111 |
"""Process texts in batches and return their embeddings."""
|
112 |
model.eval()
|
|
|
88 |
model = AutoAdapterModel.from_pretrained('allenai/specter2_aug2023refresh_base')
|
89 |
|
90 |
|
91 |
+
@spaces.GPU(duration=120)
|
92 |
def create_embeddings(texts_to_embedd):
|
93 |
# Set up the device
|
94 |
|
|
|
106 |
for i in range(0, len(data), batch_size):
|
107 |
yield data[i:i + batch_size]
|
108 |
|
109 |
+
|
110 |
def encode_texts(texts, device, batch_size=16):
|
111 |
"""Process texts in batches and return their embeddings."""
|
112 |
model.eval()
|