Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ from pinecone import Pinecone
|
|
| 12 |
# Retriever Class
|
| 13 |
# =========================
|
| 14 |
class ParrotletRetriever:
|
| 15 |
-
def __init__(self, model_name: str
|
| 16 |
"""Initialize model and Pinecone client."""
|
| 17 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
print(f"π Loading model on {self.device}...")
|
|
@@ -50,7 +50,7 @@ class ParrotletRetriever:
|
|
| 50 |
"""Encode text into normalized embeddings."""
|
| 51 |
with torch.no_grad():
|
| 52 |
encoded_input = self.tokenizer(
|
| 53 |
-
texts, padding=True, truncation=True, max_length=
|
| 54 |
).to(self.device)
|
| 55 |
|
| 56 |
model_output = self.model(**encoded_input)
|
|
|
|
| 12 |
# Retriever Class
|
| 13 |
# =========================
|
| 14 |
class ParrotletRetriever:
|
| 15 |
+
def __init__(self, model_name: str):
|
| 16 |
"""Initialize model and Pinecone client."""
|
| 17 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
print(f"π Loading model on {self.device}...")
|
|
|
|
| 50 |
"""Encode text into normalized embeddings."""
|
| 51 |
with torch.no_grad():
|
| 52 |
encoded_input = self.tokenizer(
|
| 53 |
+
texts, padding=True, truncation=True, max_length=60, return_tensors="pt"
|
| 54 |
).to(self.device)
|
| 55 |
|
| 56 |
model_output = self.model(**encoded_input)
|