Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,20 +80,20 @@ class HybridEmbeddings(Embeddings):
|
|
| 80 |
return self._embed_texts([text])[0]
|
| 81 |
|
| 82 |
# ============================================================
|
| 83 |
-
# --- LLM INITIALIZATION
|
| 84 |
# ============================================================
|
| 85 |
def initialize_llm():
|
| 86 |
if not HF_TOKEN:
|
| 87 |
raise ValueError("HF_TOKEN is not set; cannot initialize LLM.")
|
| 88 |
-
print("🔵 Initializing LLM:
|
| 89 |
try:
|
| 90 |
llm = HuggingFaceHub(
|
| 91 |
-
repo_id="
|
| 92 |
huggingfacehub_api_token=HF_TOKEN,
|
| 93 |
model_kwargs={"temperature": 0.7, "max_length": 4096},
|
| 94 |
task="text-generation",
|
| 95 |
)
|
| 96 |
-
print("✅ LLM (
|
| 97 |
return llm
|
| 98 |
except Exception as e:
|
| 99 |
print("❌ Failed to initialize LLM:", e)
|
|
|
|
| 80 |
return self._embed_texts([text])[0]
|
| 81 |
|
| 82 |
# ============================================================
|
| 83 |
+
# --- LLM INITIALIZATION
|
| 84 |
# ============================================================
|
| 85 |
def initialize_llm():
|
| 86 |
if not HF_TOKEN:
|
| 87 |
raise ValueError("HF_TOKEN is not set; cannot initialize LLM.")
|
| 88 |
+
print("🔵 Initializing LLM: Microsoft Phi…")
|
| 89 |
try:
|
| 90 |
llm = HuggingFaceHub(
|
| 91 |
+
repo_id="microsoft/phi-2",
|
| 92 |
huggingfacehub_api_token=HF_TOKEN,
|
| 93 |
model_kwargs={"temperature": 0.7, "max_length": 4096},
|
| 94 |
task="text-generation",
|
| 95 |
)
|
| 96 |
+
print("✅ LLM (Microsoft Phi) initialized successfully.")
|
| 97 |
return llm
|
| 98 |
except Exception as e:
|
| 99 |
print("❌ Failed to initialize LLM:", e)
|