Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -259,9 +259,10 @@ def get_embedding_for_text(text, tokenizer, model):
|
|
259 |
inputs = {k: v.to(model.device) for k, v in inputs.items()}
|
260 |
|
261 |
with torch.no_grad():
|
262 |
-
|
|
|
263 |
|
264 |
-
embedding = outputs
|
265 |
chunk_embeddings.append(embedding[0])
|
266 |
except Exception as e:
|
267 |
st.warning(f"Error processing chunk: {str(e)}")
|
|
|
259 |
inputs = {k: v.to(model.device) for k, v in inputs.items()}
|
260 |
|
261 |
with torch.no_grad():
|
262 |
+
# Get the correct output format
|
263 |
+
outputs = model(**inputs)[0] # Access first element of tuple
|
264 |
|
265 |
+
embedding = outputs[:, 0, :].cpu().numpy()
|
266 |
chunk_embeddings.append(embedding[0])
|
267 |
except Exception as e:
|
268 |
st.warning(f"Error processing chunk: {str(e)}")
|