Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,103 @@
|
|
1 |
-
---
|
2 |
-
license: llama3.2
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama3.2
|
3 |
+
datasets:
|
4 |
+
- prithivMLmods/PyThagoreans-Merged
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
base_model:
|
8 |
+
- meta-llama/Llama-3.2-1B-Instruct
|
9 |
+
pipeline_tag: text-generation
|
10 |
+
library_name: transformers
|
11 |
+
tags:
|
12 |
+
- math
|
13 |
+
- coder
|
14 |
+
- problem-solve
|
15 |
+
- open_coder
|
16 |
+
---
|
17 |
+
![python.gif](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/4nYxcbXSfu2Q0fIXul41e.gif)
|
18 |
+
|
19 |
+
# **PyThagorean-10B**
|
20 |
+
|
21 |
+
PyThagorean [Python + Math] is a Python and mathematics-based model designed to solve mathematical problems using Python libraries and coding. It has been fine-tuned on 1.5 million entries and is built on LLaMA's architecture. The model supports different parameter sizes, including 10B, 3B, and 1B (Tiny). These instruction-tuned, text-only models are optimized for multilingual dialogue use cases, including agent-based retrieval and summarization tasks. PyThagorean leverages an auto-regressive language model that uses an optimized transformer architecture. The tuned versions employ supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.
|
22 |
+
|
23 |
+
|
24 |
+
# **Use with transformers**
|
25 |
+
|
26 |
+
Starting with `transformers >= 4.43.0` onward, you can run conversational inference using the Transformers `pipeline` abstraction or by leveraging the Auto classes with the `generate()` function.
|
27 |
+
|
28 |
+
Make sure to update your transformers installation via `pip install --upgrade transformers`.
|
29 |
+
|
30 |
+
```python
|
31 |
+
import transformers
|
32 |
+
import torch
|
33 |
+
|
34 |
+
model_id = "prithivMLmods/PyThagorean-Tiny"
|
35 |
+
|
36 |
+
pipeline = transformers.pipeline(
|
37 |
+
"text-generation",
|
38 |
+
model=model_id,
|
39 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
40 |
+
device_map="auto",
|
41 |
+
)
|
42 |
+
|
43 |
+
messages = [
|
44 |
+
{"role": "system", "content": "You are the helpful assistant. Solve the mathematical problem in Python programming."},
|
45 |
+
{"role": "user", "content": "Find all real numbers $x$ such that \[\frac{x^3+2x^2}{x^2+3x+2} + x = -6.\]Enter all the solutions, separated by commas."},
|
46 |
+
]
|
47 |
+
|
48 |
+
outputs = pipeline(
|
49 |
+
messages,
|
50 |
+
max_new_tokens=256,
|
51 |
+
)
|
52 |
+
print(outputs[0]["generated_text"][-1])
|
53 |
+
```
|
54 |
+
|
55 |
+
# **Intended Use**
|
56 |
+
|
57 |
+
1. **Mathematical Problem Solving**:
|
58 |
+
PyThagorean is designed for solving complex mathematical problems, including algebra, calculus, trigonometry, and more, by leveraging Python-based libraries. It is ideal for educational tools, tutoring platforms, and automated math assistants.
|
59 |
+
|
60 |
+
2. **Python Code Generation**:
|
61 |
+
The model generates Python code snippets for mathematical computations, simulations, and problem-solving, making it valuable for developers, researchers, and students.
|
62 |
+
|
63 |
+
3. **Multilingual Dialogue Systems**:
|
64 |
+
With support for multiple languages, PyThagorean can assist users worldwide in understanding and solving mathematical problems through dialogue-based interfaces.
|
65 |
+
|
66 |
+
4. **Instruction-Following Tasks**:
|
67 |
+
The model excels at adhering to precise mathematical instructions and delivering accurate, step-by-step solutions for problems embedded in text.
|
68 |
+
|
69 |
+
5. **Agent-Based Knowledge Retrieval**:
|
70 |
+
PyThagorean can retrieve and summarize mathematical concepts or problem-solving techniques, enabling quick access to relevant knowledge for educational and research purposes.
|
71 |
+
|
72 |
+
6. **Educational Content Creation**:
|
73 |
+
It generates educational content such as example problems, solutions, and Python-based tutorials, aiding teachers and content creators.
|
74 |
+
|
75 |
+
7. **Summarization and Explanation**:
|
76 |
+
The model provides clear explanations and breakdowns of mathematical solutions, helping users understand the rationale and process behind the answers.
|
77 |
+
|
78 |
+
|
79 |
+
# **Limitations**
|
80 |
+
|
81 |
+
1. **Performance on Ambiguous Instructions**:
|
82 |
+
The model may struggle with ambiguous, vague, or poorly framed mathematical instructions, potentially leading to incorrect or incomplete solutions.
|
83 |
+
|
84 |
+
2. **Edge Cases and Special Scenarios**:
|
85 |
+
For highly specialized or niche mathematical problems, especially those not commonly encountered in training data, the model's performance may degrade.
|
86 |
+
|
87 |
+
3. **Errors in Multi-Step Reasoning**:
|
88 |
+
While trained on reasoning datasets, the model may sometimes produce incorrect results for multi-step or highly complex reasoning tasks, particularly if intermediate steps are not explicitly defined.
|
89 |
+
|
90 |
+
4. **Bias Toward Common Solutions**:
|
91 |
+
The model may favor standard or commonly used approaches to mathematical problems, potentially missing creative or less conventional methods of solution.
|
92 |
+
|
93 |
+
5. **Resource Intensity**:
|
94 |
+
As a large-scale model, PyThagorean requires significant computational resources, including high-end GPUs, for efficient inference and deployment.
|
95 |
+
|
96 |
+
6. **Context Window Limitations**:
|
97 |
+
The model's finite context window may lead to incomplete understanding or truncated responses for problems requiring extensive context or lengthy input.
|
98 |
+
|
99 |
+
7. **Handling of Non-Mathematical Queries**:
|
100 |
+
While capable of engaging in general conversations, its performance for non-mathematical tasks may not match models specifically tuned for broader use cases.
|
101 |
+
|
102 |
+
8. **Dependency on Python Libraries**:
|
103 |
+
Generated solutions may rely on specific Python libraries or functions, which users must have installed and configured correctly to execute the code successfully.
|