Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
9 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
10 |
|
11 |
# Load the CSV file with embeddings
|
12 |
-
df = pd.read_csv('
|
13 |
df['embedding'] = df['embedding'].apply(json.loads) # Convert JSON string back to list
|
14 |
|
15 |
# Convert embeddings to tensor for efficient retrieval
|
@@ -19,8 +19,8 @@ embeddings = torch.tensor(df['embedding'].tolist(), device=device)
|
|
19 |
model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
|
20 |
|
21 |
# Load the LLaMA model for response generation
|
22 |
-
llama_tokenizer = AutoTokenizer.from_pretrained("
|
23 |
-
llama_model = AutoModelForCausalLM.from_pretrained("
|
24 |
|
25 |
# Define the function to find the most relevant document
|
26 |
def retrieve_relevant_doc(query):
|
|
|
9 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
10 |
|
11 |
# Load the CSV file with embeddings
|
12 |
+
df = pd.read_csv('RBDx10kstats.csv')
|
13 |
df['embedding'] = df['embedding'].apply(json.loads) # Convert JSON string back to list
|
14 |
|
15 |
# Convert embeddings to tensor for efficient retrieval
|
|
|
19 |
model = SentenceTransformer('all-MiniLM-L6-v2', device=device)
|
20 |
|
21 |
# Load the LLaMA model for response generation
|
22 |
+
llama_tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
|
23 |
+
llama_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2").to(device)
|
24 |
|
25 |
# Define the function to find the most relevant document
|
26 |
def retrieve_relevant_doc(query):
|