Spaces:
Sleeping
Sleeping
Auto commit at 07-2025-08 0:14:35
Browse files
README.md
CHANGED
|
@@ -8,6 +8,7 @@ sdk_version: 5.41.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ๐งฎ Lily Math RAG System
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
multimodal: true
|
| 12 |
---
|
| 13 |
|
| 14 |
# ๐งฎ Lily Math RAG System
|
app.py
CHANGED
|
@@ -94,7 +94,15 @@ def chat_with_model(message, history):
|
|
| 94 |
try:
|
| 95 |
inputs = tokenizer(message, return_tensors="pt")
|
| 96 |
with torch.no_grad():
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 99 |
if message in response:
|
| 100 |
response = response.replace(message, "").strip()
|
|
@@ -109,7 +117,15 @@ def solve_math_problem(problem):
|
|
| 109 |
prompt = f"๋ค์ ์ํ ๋ฌธ์ ๋ฅผ ๋จ๊ณ๋ณ๋ก ํ์ด์ฃผ์ธ์: {problem}"
|
| 110 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 111 |
with torch.no_grad():
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 114 |
if prompt in response:
|
| 115 |
response = response.replace(prompt, "").strip()
|
|
|
|
| 94 |
try:
|
| 95 |
inputs = tokenizer(message, return_tensors="pt")
|
| 96 |
with torch.no_grad():
|
| 97 |
+
# ๋ฉํฐ๋ชจ๋ฌ ๋ชจ๋ธ์ generate ๋ฉ์๋ ์ฌ์ฉ (์ด๋ฏธ์ง ์์ด ํ
์คํธ๋ง)
|
| 98 |
+
outputs = model.generate(
|
| 99 |
+
input_ids=inputs["input_ids"],
|
| 100 |
+
attention_mask=inputs["attention_mask"],
|
| 101 |
+
max_new_tokens=200,
|
| 102 |
+
temperature=0.7,
|
| 103 |
+
do_sample=True,
|
| 104 |
+
pad_token_id=tokenizer.eos_token_id
|
| 105 |
+
)
|
| 106 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 107 |
if message in response:
|
| 108 |
response = response.replace(message, "").strip()
|
|
|
|
| 117 |
prompt = f"๋ค์ ์ํ ๋ฌธ์ ๋ฅผ ๋จ๊ณ๋ณ๋ก ํ์ด์ฃผ์ธ์: {problem}"
|
| 118 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 119 |
with torch.no_grad():
|
| 120 |
+
# ๋ฉํฐ๋ชจ๋ฌ ๋ชจ๋ธ์ generate ๋ฉ์๋ ์ฌ์ฉ (์ด๋ฏธ์ง ์์ด ํ
์คํธ๋ง)
|
| 121 |
+
outputs = model.generate(
|
| 122 |
+
input_ids=inputs["input_ids"],
|
| 123 |
+
attention_mask=inputs["attention_mask"],
|
| 124 |
+
max_new_tokens=300,
|
| 125 |
+
temperature=0.3,
|
| 126 |
+
do_sample=True,
|
| 127 |
+
pad_token_id=tokenizer.eos_token_id
|
| 128 |
+
)
|
| 129 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 130 |
if prompt in response:
|
| 131 |
response = response.replace(prompt, "").strip()
|