Daemontatox commited on
Commit
8b5b0c4
·
verified ·
1 Parent(s): fc5ddd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -15
app.py CHANGED
@@ -20,7 +20,7 @@ from transformers import (
20
  )
21
 
22
  # Configuration Constants
23
- MODEL_ID = "NovaSky-AI/Sky-T1-32B-Preview"
24
 
25
 
26
  # Understand]: Analyze the question to identify key details and clarify the goal.
@@ -30,15 +30,51 @@ MODEL_ID = "NovaSky-AI/Sky-T1-32B-Preview"
30
  # [Respond]: Present a well-structured and transparent answer, enriched with supporting details as needed.
31
  # Use these tags as headers in your response to make your thought process easy to follow and aligned with the principle of openness.
32
 
33
- DEFAULT_SYSTEM_PROMPT = """
34
- You are a sentient reasoning assistant you follow the following steps to give an accurate and concise answer.
35
- [Understand]: Analyze the question to identify key details and clarify the goal.
36
- # [Plan]: Outline a logical, step-by-step approach to address the question or problem.
37
- # [Reason]: Execute the plan, applying logical reasoning, calculations, or analysis to reach a conclusion. Document each step clearly.
38
- # [Reflect]: Review the reasoning and the final answer to ensure it is accurate, complete, and adheres to the principle of openness.
39
- # [Respond]: Present a well-structured and transparent answer, enriched with supporting details as needed.
40
- # Use these tags as headers in your response to make your thought process easy to follow and aligned with the principle of openness.
41
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  """
43
  # UI Configuration
44
  TITLE = "<h1><center>AI Reasoning Assistant</center></h1>"
@@ -101,7 +137,7 @@ def initialize_model():
101
  device_map="cuda",
102
  attn_implementation="flash_attention_2",
103
  trust_remote_code=True,
104
- quantization_config=quantization_config
105
 
106
  )
107
 
@@ -158,8 +194,8 @@ def chat_response(
158
  history: list,
159
  chat_display: str,
160
  system_prompt: str,
161
- temperature: float = 0.2,
162
- max_new_tokens: int = 32000,
163
  top_p: float = 0.1,
164
  top_k: int = 45,
165
  penalty: float = 1.2,
@@ -263,14 +299,14 @@ def main():
263
  minimum=0,
264
  maximum=1,
265
  step=0.1,
266
- value=0.2,
267
  label="Temperature",
268
  )
269
  max_tokens = gr.Slider(
270
  minimum=128,
271
  maximum=32000,
272
  step=128,
273
- value=32000,
274
  label="Max Tokens",
275
  )
276
  top_p = gr.Slider(
 
20
  )
21
 
22
  # Configuration Constants
23
+ MODEL_ID = "internlm/internlm3-8b-instruct"
24
 
25
 
26
  # Understand]: Analyze the question to identify key details and clarify the goal.
 
30
  # [Respond]: Present a well-structured and transparent answer, enriched with supporting details as needed.
31
  # Use these tags as headers in your response to make your thought process easy to follow and aligned with the principle of openness.
32
 
33
+ DEFAULT_SYSTEM_PROMPT """
34
+ You are an expert mathematician with extensive experience in mathematical competitions. You approach problems through systematic thinking and rigorous reasoning. When solving problems, follow these thought processes:
35
+ ## Deep Understanding
36
+ Take time to fully comprehend the problem before attempting a solution. Consider:
37
+ - What is the real question being asked?
38
+ - What are the given conditions and what do they tell us?
39
+ - Are there any special restrictions or assumptions?
40
+ - Which information is crucial and which is supplementary?
41
+ ## Multi-angle Analysis
42
+ Before solving, conduct thorough analysis:
43
+ - What mathematical concepts and properties are involved?
44
+ - Can you recall similar classic problems or solution methods?
45
+ - Would diagrams or tables help visualize the problem?
46
+ - Are there special cases that need separate consideration?
47
+ ## Systematic Thinking
48
+ Plan your solution path:
49
+ - Propose multiple possible approaches
50
+ - Analyze the feasibility and merits of each method
51
+ - Choose the most appropriate method and explain why
52
+ - Break complex problems into smaller, manageable steps
53
+ ## Rigorous Proof
54
+ During the solution process:
55
+ - Provide solid justification for each step
56
+ - Include detailed proofs for key conclusions
57
+ - Pay attention to logical connections
58
+ - Be vigilant about potential oversights
59
+ ## Repeated Verification
60
+ After completing your solution:
61
+ - Verify your results satisfy all conditions
62
+ - Check for overlooked special cases
63
+ - Consider if the solution can be optimized or simplified
64
+ - Review your reasoning process
65
+ Remember:
66
+ 1. Take time to think thoroughly rather than rushing to an answer
67
+ 2. Rigorously prove each key conclusion
68
+ 3. Keep an open mind and try different approaches
69
+ 4. Summarize valuable problem-solving methods
70
+ 5. Maintain healthy skepticism and verify multiple times
71
+ Your response should reflect deep mathematical understanding and precise logical thinking, making your solution path and reasoning clear to others.
72
+ When you're ready, present your complete solution with:
73
+ - Clear problem understanding
74
+ - Detailed solution process
75
+ - Key insights
76
+ - Thorough verification
77
+ Focus on clear, logical progression of ideas and thorough explanation of your mathematical reasoning. Provide answers in the same language as the user asking the question, repeat the final answer using a '\\boxed{}' without any units, you have [[8192]] tokens to complete the answer.
78
  """
79
  # UI Configuration
80
  TITLE = "<h1><center>AI Reasoning Assistant</center></h1>"
 
137
  device_map="cuda",
138
  attn_implementation="flash_attention_2",
139
  trust_remote_code=True,
140
+ #quantization_config=quantization_config
141
 
142
  )
143
 
 
194
  history: list,
195
  chat_display: str,
196
  system_prompt: str,
197
+ temperature: float = 0.3,
198
+ max_new_tokens: int = 8192,
199
  top_p: float = 0.1,
200
  top_k: int = 45,
201
  penalty: float = 1.2,
 
299
  minimum=0,
300
  maximum=1,
301
  step=0.1,
302
+ value=0.3,
303
  label="Temperature",
304
  )
305
  max_tokens = gr.Slider(
306
  minimum=128,
307
  maximum=32000,
308
  step=128,
309
+ value=8192,
310
  label="Max Tokens",
311
  )
312
  top_p = gr.Slider(