Update app.py
Browse files
app.py
CHANGED
|
@@ -67,8 +67,11 @@ vectorstore = LangChainFAISS(
|
|
| 67 |
print("✅ FAISS vectorstore ready.")
|
| 68 |
|
| 69 |
# === 5. Load GPT-2 for Generation ===
|
| 70 |
-
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 71 |
-
model = AutoModelForCausalLM.from_pretrained("gpt2").to("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
text_gen_pipeline = pipeline(
|
| 74 |
"text-generation",
|
|
@@ -82,7 +85,7 @@ text_gen_pipeline = pipeline(
|
|
| 82 |
)
|
| 83 |
|
| 84 |
llm = HuggingFacePipeline(pipeline=text_gen_pipeline)
|
| 85 |
-
print("✅ GPT-2 loaded.")
|
| 86 |
|
| 87 |
# === 6. Prompt Formatting and Answer Logic ===
|
| 88 |
def truncate_context(context, max_length=1024):
|
|
|
|
| 67 |
print("✅ FAISS vectorstore ready.")
|
| 68 |
|
| 69 |
# === 5. Load GPT-2 for Generation ===
|
| 70 |
+
#tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 71 |
+
#model = AutoModelForCausalLM.from_pretrained("gpt2").to("cuda" if torch.cuda.is_available() else "cpu")
|
| 72 |
+
|
| 73 |
+
tokenizer = AutoTokenizer.from_pretrained("tiiuae/Falcon3-7B-Instruct")
|
| 74 |
+
model = AutoModelForCausalLM.from_pretrained("tiiuae/Falcon3-7B-Instruct")
|
| 75 |
|
| 76 |
text_gen_pipeline = pipeline(
|
| 77 |
"text-generation",
|
|
|
|
| 85 |
)
|
| 86 |
|
| 87 |
llm = HuggingFacePipeline(pipeline=text_gen_pipeline)
|
| 88 |
+
#print("✅ GPT-2 loaded.")
|
| 89 |
|
| 90 |
# === 6. Prompt Formatting and Answer Logic ===
|
| 91 |
def truncate_context(context, max_length=1024):
|