初始化项目,由ModelHub XC社区提供模型
Model: cs-552-2026-4neurons/math_model Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
101
EVAL_REPORT.md
Normal file
101
EVAL_REPORT.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Automated MNLP evaluation report
|
||||
|
||||
- **Model repo:** [`cs-552-2026-4neurons/math_model`](https://huggingface.co/cs-552-2026-4neurons/math_model)
|
||||
- **Owner(s):** group **4neurons**
|
||||
- **Generated at:** 2026-06-08T04:40:54+00:00 (UTC)
|
||||
- **Pipeline:** [mnlp-project-ci](https://github.com/eric11eca/mnlp-project-ci)
|
||||
|
||||
_This PR is opened automatically by the course CI. It is **non-blocking** — you do not need to merge it. The next nightly run will refresh this file._
|
||||
|
||||
## Evaluated checkpoint
|
||||
|
||||
- **Commit:** [`9b57663`](https://huggingface.co/cs-552-2026-4neurons/math_model/commit/9b57663282076a91efe6f5eec880675c011f6f0e)
|
||||
- **Message:** Upload checkpoint-200 math model with patched math chat template
|
||||
- **Committed:** 2026-06-06T19:42:53+00:00
|
||||
|
||||
## Summary
|
||||
|
||||
| Benchmark | Accuracy | Status |
|
||||
|---|---:|---|
|
||||
| Math | 0.4400 | ok |
|
||||
| Knowledge | — | not run |
|
||||
| Multilingual | — | not run |
|
||||
| Safety | — | not run |
|
||||
|
||||
## Sample completions
|
||||
|
||||
_Prompts are intentionally omitted to avoid revealing benchmark contents. For multi-completion problems, only one completion is shown per sample._
|
||||
|
||||
### Math
|
||||
|
||||
**Correct** (1 shown)
|
||||
|
||||
- **reference**: `305`
|
||||
- **overall** (2/8 completions correct)
|
||||
- **extracted** (✓): `305`
|
||||
- **completion**:
|
||||
|
||||
```text
|
||||
<think>
|
||||
Okay, let's try to tackle this problem step by step. So, we need to find all positive integers n between 99 and 206 such that the numbers 1 to 2n can be partitioned into n pairs where the differences within each pair are exactly 1, 2, ..., n. Then, among all such n, find the smallest (m) and the largest (M) and compute m + M.
|
||||
|
||||
First, let's understand the problem. We have to partition the s
|
||||
|
||||
... [truncated 822 chars] ...
|
||||
|
||||
into \( n \) pairs with differences exactly \( 1, 2, \ldots, n \). We then find the least and greatest elements \( m \) and \( M \) of \( S \) and compute \( m + M \).
|
||||
|
||||
1. **Understanding the Problem**:
|
||||
- We need to partition the set \(\{1, 2, \ldots, 2n\}\) into \( n \) pairs such that each pair has a unique difference from 1 to \( n \).
|
||||
- Each difference must be used exactly once.
|
||||
|
||||
2. **Key Observations**:
|
||||
- For each difference \( k \) from 1 to \( n \), there must be exactly one pair of numbers in \(\{1, 2, \ldots, 2n\}\) with difference \( k \).
|
||||
- This is equivalent to finding a permutation where each element is paired with another element such that the difference is unique.
|
||||
|
||||
3. **Existence of Such Pairings**:
|
||||
- Research and analysis show that such pairings (called difference permutations) exist for all \( n \geq 1 \).
|
||||
- The smallest \( n \) in the given range is 99, and the largest is 206.
|
||||
|
||||
4. **Conclusion**:
|
||||
- The smallest \( n \) is 99, and the largest \( n \) is 206.
|
||||
- Therefore, the least element \( m \) is 99, the greatest element \( M \) is 206, and their sum is \( 99 + 206 = 305 \).
|
||||
|
||||
\[
|
||||
\boxed{305}
|
||||
\]
|
||||
|
||||
Therefore, the final answer is \boxed{305}.
|
||||
```
|
||||
|
||||
**Incorrect** (1 shown)
|
||||
|
||||
- **reference**: `7200`
|
||||
- **overall** (0/8 completions correct)
|
||||
- **extracted** (✗): `1441200`
|
||||
- **completion**:
|
||||
|
||||
```text
|
||||
<think>
|
||||
Okay, let's try to tackle this problem step by step. So, we need to find the number of polynomials P with integer coefficients that satisfy three conditions. Let's break them down one by one.
|
||||
|
||||
First, the polynomial P has degree at most 3, so it's of the form P(x) = ax³ + bx² + cx + d, where a, b, c, d are integers. The coefficients are between 0 and 2012, inclusive. So each of the coeffici
|
||||
|
||||
... [truncated 822 chars] ...
|
||||
|
||||
r all \( x \). Simplifying, we get \( 2b \equiv 0 \pmod{2013} \) and \( 2d \equiv 0 \pmod{2013} \). Since 2013 is odd, this implies \( b \equiv 0 \pmod{2013} \) and \( d \equiv 0 \pmod{2013} \). Thus, \( b = 0 \) and \( d = 0 \), simplifying \( P(x) \) to \( ax^3 + cx \).
|
||||
|
||||
Next, we need \( P(x) = ax^3 + cx \) to have distinct residues modulo 2013 for \( x = 0, 1, \ldots, 2012 \). This requires \( ax^3 + cx \) to be a permutation polynomial modulo 2013.
|
||||
|
||||
For \( P(x) \) to be a permutation polynomial modulo 2013, \( a \) and \( c \) must be invertible modulo 2013. The number of invertible elements modulo 2013 is given by Euler's totient function \( \phi(2013) \). Since \( 2013 = 3 \times 11 \times 61 \), we have \( \phi(2013) = 2 \times 10 \times 60 = 1200 \).
|
||||
|
||||
There are two cases:
|
||||
1. \( a = 0 \) and \( c \) is invertible. There are 1200 choices for \( c \).
|
||||
2. \( a \neq 0 \) and both \( a \) and \( c \) are invertible. There are \( 1200 \times 1200 = 1,440,000 \) choices for \( a \) and \( c \).
|
||||
|
||||
Summing these cases, the total number of polynomials is \( 1200 + 1,440,000 = 1,441,200 \).
|
||||
|
||||
Thus, the final answer is \(\boxed{1441200}\).
|
||||
|
||||
Therefore, the final answer is \boxed{1441200}.
|
||||
```
|
||||
199
README.md
Normal file
199
README.md
Normal file
@@ -0,0 +1,199 @@
|
||||
---
|
||||
library_name: transformers
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Model Card for Model ID
|
||||
|
||||
<!-- Provide a quick summary of what the model is/does. -->
|
||||
|
||||
|
||||
|
||||
## Model Details
|
||||
|
||||
### Model Description
|
||||
|
||||
<!-- Provide a longer summary of what this model is. -->
|
||||
|
||||
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
||||
|
||||
- **Developed by:** [More Information Needed]
|
||||
- **Funded by [optional]:** [More Information Needed]
|
||||
- **Shared by [optional]:** [More Information Needed]
|
||||
- **Model type:** [More Information Needed]
|
||||
- **Language(s) (NLP):** [More Information Needed]
|
||||
- **License:** [More Information Needed]
|
||||
- **Finetuned from model [optional]:** [More Information Needed]
|
||||
|
||||
### Model Sources [optional]
|
||||
|
||||
<!-- Provide the basic links for the model. -->
|
||||
|
||||
- **Repository:** [More Information Needed]
|
||||
- **Paper [optional]:** [More Information Needed]
|
||||
- **Demo [optional]:** [More Information Needed]
|
||||
|
||||
## Uses
|
||||
|
||||
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
||||
|
||||
### Direct Use
|
||||
|
||||
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Downstream Use [optional]
|
||||
|
||||
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Out-of-Scope Use
|
||||
|
||||
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Bias, Risks, and Limitations
|
||||
|
||||
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Recommendations
|
||||
|
||||
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
||||
|
||||
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
||||
|
||||
## How to Get Started with the Model
|
||||
|
||||
Use the code below to get started with the model.
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Training Details
|
||||
|
||||
### Training Data
|
||||
|
||||
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Training Procedure
|
||||
|
||||
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
||||
|
||||
#### Preprocessing [optional]
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
|
||||
#### Training Hyperparameters
|
||||
|
||||
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
||||
|
||||
#### Speeds, Sizes, Times [optional]
|
||||
|
||||
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Evaluation
|
||||
|
||||
<!-- This section describes the evaluation protocols and provides the results. -->
|
||||
|
||||
### Testing Data, Factors & Metrics
|
||||
|
||||
#### Testing Data
|
||||
|
||||
<!-- This should link to a Dataset Card if possible. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Factors
|
||||
|
||||
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Metrics
|
||||
|
||||
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Results
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Summary
|
||||
|
||||
|
||||
|
||||
## Model Examination [optional]
|
||||
|
||||
<!-- Relevant interpretability work for the model goes here -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Environmental Impact
|
||||
|
||||
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
||||
|
||||
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
||||
|
||||
- **Hardware Type:** [More Information Needed]
|
||||
- **Hours used:** [More Information Needed]
|
||||
- **Cloud Provider:** [More Information Needed]
|
||||
- **Compute Region:** [More Information Needed]
|
||||
- **Carbon Emitted:** [More Information Needed]
|
||||
|
||||
## Technical Specifications [optional]
|
||||
|
||||
### Model Architecture and Objective
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Compute Infrastructure
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Hardware
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Software
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Citation [optional]
|
||||
|
||||
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||
|
||||
**BibTeX:**
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
**APA:**
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Glossary [optional]
|
||||
|
||||
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## More Information [optional]
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Model Card Authors [optional]
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Model Card Contact
|
||||
|
||||
[More Information Needed]
|
||||
94
chat_template.jinja
Normal file
94
chat_template.jinja
Normal file
@@ -0,0 +1,94 @@
|
||||
{%- set enable_thinking = true %}
|
||||
{%- set default_system_prompt = "You are a rigorous competition-math solver. Solve problems from prealgebra, algebra, number theory, combinatorics, probability, geometry, precalculus, and calculus.\n\nUse only information stated in the problem. Do not invent missing facts, hidden diagram properties, extra assumptions, or numerical values. \n\nWork carefully and verify each important step. Prefer exact symbolic reasoning over decimal approximations. Keep track of definitions, constraints, and edge cases.\n\nFor geometry, justify angle, length, arc, parallel, cyclic, and similarity claims before using them.\nFor counting and probability, avoid double-counting and check whether cases are disjoint and exhaustive.\nFor algebra, check domains and discard extraneous solutions.\n\nIf there are multiple plausible approaches, choose the most reliable one and complete it. If you are uncertain, give the best-supported answer from your derivation rather than making up unsupported facts.\n\nYour response may include concise reasoning, but the final answer must appear at the very end in LaTeX boxed format: \\\\boxed{answer}. Do not write anything after the final \\\\boxed{answer}.\nExamples: If the answer is 42, write \\\\boxed{42}, if the answer is p-q, write \\\\boxed{p - q}.\nFor polynomials, the answer should first display the higher order and be reduced as much as possible. Example \\\\boxed{x^3 - 300x^2 + 30000x - 999900} instead of \\\\boxed{- 999900 + x^3 - 300x^2 + 30000x } (incorrect order) or \\\\boxed{x^3 - 300x^2 + 30000x - 1000000 + 100} (not reduced)" %}
|
||||
{%- if messages[0]['role'] != 'system' %}
|
||||
{%- set messages = [{'role': 'system', 'content': default_system_prompt}] + messages %}
|
||||
{%- endif %}
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- messages[0].content + '\n\n' }}
|
||||
{%- endif %}
|
||||
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||
{%- for message in messages[::-1] %}
|
||||
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
||||
{%- set ns.multi_step_tool = false %}
|
||||
{%- set ns.last_query_index = index %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for message in messages %}
|
||||
{%- if message.content is string %}
|
||||
{%- set content = message.content %}
|
||||
{%- else %}
|
||||
{%- set content = '' %}
|
||||
{%- endif %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{%- set reasoning_content = '' %}
|
||||
{%- if message.reasoning_content is string %}
|
||||
{%- set reasoning_content = message.reasoning_content %}
|
||||
{%- else %}
|
||||
{%- if '</think>' in content %}
|
||||
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
||||
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if loop.index0 > ns.last_query_index %}
|
||||
{%- if loop.last or (not loop.last and reasoning_content) %}
|
||||
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- if message.tool_calls %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if (loop.first and content) or (not loop.first) %}
|
||||
{{- '\n' }}
|
||||
{%- endif %}
|
||||
{%- if tool_call.function %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{%- endif %}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||
{{- '<think>\n\n</think>\n\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
90
chat_template.jinja.bak
Normal file
90
chat_template.jinja.bak
Normal file
@@ -0,0 +1,90 @@
|
||||
{%- set enable_thinking = true %}
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- messages[0].content + '\n\n' }}
|
||||
{%- endif %}
|
||||
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||
{%- for message in messages[::-1] %}
|
||||
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
||||
{%- set ns.multi_step_tool = false %}
|
||||
{%- set ns.last_query_index = index %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for message in messages %}
|
||||
{%- if message.content is string %}
|
||||
{%- set content = message.content %}
|
||||
{%- else %}
|
||||
{%- set content = '' %}
|
||||
{%- endif %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{%- set reasoning_content = '' %}
|
||||
{%- if message.reasoning_content is string %}
|
||||
{%- set reasoning_content = message.reasoning_content %}
|
||||
{%- else %}
|
||||
{%- if '</think>' in content %}
|
||||
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
||||
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if loop.index0 > ns.last_query_index %}
|
||||
{%- if loop.last or (not loop.last and reasoning_content) %}
|
||||
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- if message.tool_calls %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if (loop.first and content) or (not loop.first) %}
|
||||
{{- '\n' }}
|
||||
{%- endif %}
|
||||
{%- if tool_call.function %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{%- endif %}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||
{{- '<think>\n\n</think>\n\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
63
config.json
Normal file
63
config.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen3ForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 151643,
|
||||
"dtype": "bfloat16",
|
||||
"eos_token_id": 151645,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 6144,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 40960,
|
||||
"max_window_layers": 28,
|
||||
"model_type": "qwen3",
|
||||
"num_attention_heads": 16,
|
||||
"num_hidden_layers": 28,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": null,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 1000000,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.7.0",
|
||||
"use_cache": true,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
1
default_system_prompt.txt
Normal file
1
default_system_prompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
You are a helpful math assistant. Solve the problem, show the reasoning, and end with the final answer in LaTeX \boxed{answer} format.
|
||||
13
generation_config.json
Normal file
13
generation_config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"bos_token_id": 151643,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"temperature": 0.7,
|
||||
"top_k": 20,
|
||||
"top_p": 0.9,
|
||||
"transformers_version": "5.7.0"
|
||||
}
|
||||
10
merge_metadata.json
Normal file
10
merge_metadata.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"adapter_dir": "/scratch/checkpoints/qwen3-1.7b-competition-simple-sft-lora",
|
||||
"base_model_name_or_path": "/scratch/hf_cache/hub/models--Qwen--Qwen3-1.7B/snapshots/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e",
|
||||
"cache_dir": "/scratch/hf_cache",
|
||||
"default_system_prompt_source": "/scratch/checkpoints/qwen3-1.7b-competition-simple-sft-merged/simple_sft_args.json",
|
||||
"injected_default_system_prompt": true,
|
||||
"max_shard_size": "4GB",
|
||||
"safe_serialization": true,
|
||||
"torch_dtype": "bfloat16"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:264c37b6a60d5366b6cf101ad923eda22d5db387cea5e8d9ac5d17b662b6e949
|
||||
size 3441185608
|
||||
59
simple_sft_args.json
Normal file
59
simple_sft_args.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"attn_implementation": null,
|
||||
"bf16": null,
|
||||
"cache_dir": "/scratch/hf_cache",
|
||||
"data_file": "/scratch/hf_cache/competition_math_train_sft",
|
||||
"dataset_config": null,
|
||||
"dataset_name": null,
|
||||
"dry_run": false,
|
||||
"filter_overlong": true,
|
||||
"fp16": null,
|
||||
"gradient_accumulation_steps": 8,
|
||||
"gradient_checkpointing": true,
|
||||
"learning_rate": 0.0002,
|
||||
"logging_steps": 25,
|
||||
"lora_alpha": 32,
|
||||
"lora_dropout": 0.05,
|
||||
"lora_r": 16,
|
||||
"lora_target_modules": "q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj",
|
||||
"lr_scheduler_type": "cosine",
|
||||
"max_grad_norm": 1.0,
|
||||
"max_seq_length": 4096,
|
||||
"max_train_samples": null,
|
||||
"model_name_or_path": "/scratch/hf_cache/hub/models--Qwen--Qwen3-1.7B/snapshots/70d244cc86ccca08cf5af4e1e306ecf908b1ad5e",
|
||||
"num_train_epochs": 1.0,
|
||||
"optim": "adamw_torch",
|
||||
"output_dir": "/scratch/checkpoints/qwen3-1.7b-competition-simple-sft-lora",
|
||||
"per_device_train_batch_size": 1,
|
||||
"preprocessing_num_workers": null,
|
||||
"problem_column": "problem",
|
||||
"report_to": "wandb",
|
||||
"require_boxed": true,
|
||||
"resume_from_checkpoint": null,
|
||||
"save_steps": 500,
|
||||
"save_total_limit": 2,
|
||||
"seed": 42,
|
||||
"shuffle": true,
|
||||
"solution_column": "solution",
|
||||
"split": "train",
|
||||
"system_prompt": "You are a helpful math assistant. Solve the problem, show the reasoning, and end with the final answer in LaTeX \\boxed{answer} format.",
|
||||
"tf32": true,
|
||||
"thinking_mode": null,
|
||||
"torch_dtype": "bfloat16",
|
||||
"trust_remote_code": true,
|
||||
"user_prompt_template": "{problem}",
|
||||
"wandb_api_key": null,
|
||||
"wandb_api_key_file": null,
|
||||
"wandb_dir": "/scratch/wandb",
|
||||
"wandb_entity": null,
|
||||
"wandb_group": null,
|
||||
"wandb_job_type": "train",
|
||||
"wandb_log_model": null,
|
||||
"wandb_mode": null,
|
||||
"wandb_name": "simple-sft-run1",
|
||||
"wandb_notes": null,
|
||||
"wandb_project": "4neurons-math",
|
||||
"wandb_tags": null,
|
||||
"warmup_ratio": 0.03,
|
||||
"weight_decay": 0.0
|
||||
}
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
||||
size 11422650
|
||||
30
tokenizer_config.json
Normal file
30
tokenizer_config.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"is_local": true,
|
||||
"local_files_only": false,
|
||||
"model_max_length": 131072,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
Reference in New Issue
Block a user