初始化项目,由ModelHub XC社区提供模型
Model: prithivMLmods/PyThagorean-Tiny Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
*.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
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
103
README.md
Normal file
103
README.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
license: llama3.2
|
||||
datasets:
|
||||
- prithivMLmods/PyThagoreans-Merged
|
||||
language:
|
||||
- en
|
||||
base_model:
|
||||
- meta-llama/Llama-3.2-1B-Instruct
|
||||
pipeline_tag: text-generation
|
||||
library_name: transformers
|
||||
tags:
|
||||
- math
|
||||
- coder
|
||||
- problem-solve
|
||||
- open_coder
|
||||
---
|
||||

|
||||
|
||||
# **PyThagorean-1B**
|
||||
|
||||
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.
|
||||
|
||||
|
||||
# **Use with transformers**
|
||||
|
||||
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.
|
||||
|
||||
Make sure to update your transformers installation via `pip install --upgrade transformers`.
|
||||
|
||||
```python
|
||||
import transformers
|
||||
import torch
|
||||
|
||||
model_id = "prithivMLmods/PyThagorean-Tiny"
|
||||
|
||||
pipeline = transformers.pipeline(
|
||||
"text-generation",
|
||||
model=model_id,
|
||||
model_kwargs={"torch_dtype": torch.bfloat16},
|
||||
device_map="auto",
|
||||
)
|
||||
|
||||
messages = [
|
||||
{"role": "system", "content": "You are the helpful assistant. Solve the mathematical problem in Python programming."},
|
||||
{"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."},
|
||||
]
|
||||
|
||||
outputs = pipeline(
|
||||
messages,
|
||||
max_new_tokens=256,
|
||||
)
|
||||
print(outputs[0]["generated_text"][-1])
|
||||
```
|
||||
|
||||
# **Intended Use**
|
||||
|
||||
1. **Mathematical Problem Solving**:
|
||||
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.
|
||||
|
||||
2. **Python Code Generation**:
|
||||
The model generates Python code snippets for mathematical computations, simulations, and problem-solving, making it valuable for developers, researchers, and students.
|
||||
|
||||
3. **Multilingual Dialogue Systems**:
|
||||
With support for multiple languages, PyThagorean can assist users worldwide in understanding and solving mathematical problems through dialogue-based interfaces.
|
||||
|
||||
4. **Instruction-Following Tasks**:
|
||||
The model excels at adhering to precise mathematical instructions and delivering accurate, step-by-step solutions for problems embedded in text.
|
||||
|
||||
5. **Agent-Based Knowledge Retrieval**:
|
||||
PyThagorean can retrieve and summarize mathematical concepts or problem-solving techniques, enabling quick access to relevant knowledge for educational and research purposes.
|
||||
|
||||
6. **Educational Content Creation**:
|
||||
It generates educational content such as example problems, solutions, and Python-based tutorials, aiding teachers and content creators.
|
||||
|
||||
7. **Summarization and Explanation**:
|
||||
The model provides clear explanations and breakdowns of mathematical solutions, helping users understand the rationale and process behind the answers.
|
||||
|
||||
|
||||
# **Limitations**
|
||||
|
||||
1. **Performance on Ambiguous Instructions**:
|
||||
The model may struggle with ambiguous, vague, or poorly framed mathematical instructions, potentially leading to incorrect or incomplete solutions.
|
||||
|
||||
2. **Edge Cases and Special Scenarios**:
|
||||
For highly specialized or niche mathematical problems, especially those not commonly encountered in training data, the model's performance may degrade.
|
||||
|
||||
3. **Errors in Multi-Step Reasoning**:
|
||||
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.
|
||||
|
||||
4. **Bias Toward Common Solutions**:
|
||||
The model may favor standard or commonly used approaches to mathematical problems, potentially missing creative or less conventional methods of solution.
|
||||
|
||||
5. **Resource Intensity**:
|
||||
As a large-scale model, PyThagorean requires significant computational resources, including high-end GPUs, for efficient inference and deployment.
|
||||
|
||||
6. **Context Window Limitations**:
|
||||
The model's finite context window may lead to incomplete understanding or truncated responses for problems requiring extensive context or lengthy input.
|
||||
|
||||
7. **Handling of Non-Mathematical Queries**:
|
||||
While capable of engaging in general conversations, its performance for non-mathematical tasks may not match models specifically tuned for broader use cases.
|
||||
|
||||
8. **Dependency on Python Libraries**:
|
||||
Generated solutions may rely on specific Python libraries or functions, which users must have installed and configured correctly to execute the code successfully.
|
||||
41
config.json
Normal file
41
config.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"_name_or_path": "meta-llama/Llama-3.2-1B-Instruct",
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"head_dim": 64,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 8192,
|
||||
"max_position_embeddings": 131072,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 16,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": 128004,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": {
|
||||
"factor": 32.0,
|
||||
"high_freq_factor": 4.0,
|
||||
"low_freq_factor": 1.0,
|
||||
"original_max_position_embeddings": 8192,
|
||||
"rope_type": "llama3"
|
||||
},
|
||||
"rope_theta": 500000.0,
|
||||
"tie_word_embeddings": true,
|
||||
"torch_dtype": "float16",
|
||||
"transformers_version": "4.47.1",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128256
|
||||
}
|
||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
||||
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||
14
generation_config.json
Normal file
14
generation_config.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"bos_token_id": 128000,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"max_length": 131072,
|
||||
"pad_token_id": 128004,
|
||||
"temperature": 0.6,
|
||||
"top_p": 0.9,
|
||||
"transformers_version": "4.47.1"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0950683986e28eae483ca298d32c2448fe6d787bc5269bc12a273d09c75e614e
|
||||
size 2471645464
|
||||
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<|begin_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "<|eot_id|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "<|finetune_right_pad_id|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6b9e4e7fb171f92fd137b777cc2714bf87d11576700a1dcd7a399e7bbe39537b
|
||||
size 17209920
|
||||
2065
tokenizer_config.json
Normal file
2065
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user