Update app.py
Browse files
app.py
CHANGED
@@ -7,11 +7,11 @@ import re
|
|
7 |
import uuid
|
8 |
|
9 |
# Load model and tokenizer
|
10 |
-
|
11 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
def format_math(text):
|
17 |
text = re.sub(r"\[(.*?)\]", r"$$\1$$", text, flags=re.DOTALL)
|
@@ -29,8 +29,8 @@ def generate_response(user_message, max_tokens, temperature, top_p, history_stat
|
|
29 |
if not user_message.strip():
|
30 |
return history_state, history_state
|
31 |
|
32 |
-
model =
|
33 |
-
tokenizer =
|
34 |
start_tag = "<|im_start|>"
|
35 |
sep_tag = "<|im_sep|>"
|
36 |
end_tag = "<|im_end|>"
|
@@ -121,8 +121,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
121 |
# INTRO TEXT MOVED HERE
|
122 |
gr.Markdown(
|
123 |
"""
|
124 |
-
Welcome to the Ramanujan Ganit R1 14B V1 Chatbot, developed by Fractal AI Research!
|
|
|
125 |
Our model excels at reasoning tasks in mathematics and science.
|
|
|
126 |
Try the example problems below from JEE Main 2025 or type in your own problems to see how our model breaks down complex reasoning problems.
|
127 |
"""
|
128 |
)
|
|
|
7 |
import uuid
|
8 |
|
9 |
# Load model and tokenizer
|
10 |
+
our_model_path = "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B"
|
11 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
12 |
|
13 |
+
our_model = AutoModelForCausalLM.from_pretrained(our_model_path, device_map="auto", torch_dtype="auto")
|
14 |
+
our_tokenizer = AutoTokenizer.from_pretrained(our_model_path)
|
15 |
|
16 |
def format_math(text):
|
17 |
text = re.sub(r"\[(.*?)\]", r"$$\1$$", text, flags=re.DOTALL)
|
|
|
29 |
if not user_message.strip():
|
30 |
return history_state, history_state
|
31 |
|
32 |
+
model = our_model
|
33 |
+
tokenizer = our_tokenizer
|
34 |
start_tag = "<|im_start|>"
|
35 |
sep_tag = "<|im_sep|>"
|
36 |
end_tag = "<|im_end|>"
|
|
|
121 |
# INTRO TEXT MOVED HERE
|
122 |
gr.Markdown(
|
123 |
"""
|
124 |
+
Welcome to the Ramanujan Ganit R1 14B V1 Chatbot, developed by Fractal AI Research!
|
125 |
+
|
126 |
Our model excels at reasoning tasks in mathematics and science.
|
127 |
+
|
128 |
Try the example problems below from JEE Main 2025 or type in your own problems to see how our model breaks down complex reasoning problems.
|
129 |
"""
|
130 |
)
|