Updated Readme file
Browse files
README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# **MiniLLM Geometry Engine**
|
| 2 |
+
|
| 3 |
+
MiniLLM Geometry Engine is a fine-tuned version of the TinyLlama 1.1B
|
| 4 |
+
language model, optimized for generating geometry-related functions for
|
| 5 |
+
a geometry engine. Fine-tuned on a custom Geometry Chain-of-Thought
|
| 6 |
+
(CoT) dataset, this model excels at producing accurate and efficient
|
| 7 |
+
mathematical functions for geometric computations, stored in the Hugging
|
| 8 |
+
Face .safetensors format for secure and efficient model loading.
|
| 9 |
+
|
| 10 |
+
## **Model Overview**
|
| 11 |
+
|
| 12 |
+
- **Base Model**: TinyLlama 1.1B
|
| 13 |
+
|
| 14 |
+
- **Fine-Tuning Dataset**: Custom Geometry CoT dataset, including
|
| 15 |
+
> 2D/3D shapes, trigonometry, and coordinate geometry problems
|
| 16 |
+
|
| 17 |
+
- **Model Format**: .safetensors for secure and efficient weight
|
| 18 |
+
> storage
|
| 19 |
+
|
| 20 |
+
- **Intended Use**: Generating geometry functions for educational
|
| 21 |
+
> tools, CAD software, game development, or computational geometry
|
| 22 |
+
|
| 23 |
+
- **License**: MIT
|
| 24 |
+
|
| 25 |
+
- **Contact**: Contact via Hugging Face profile
|
| 26 |
+
|
| 27 |
+
## **Important Note:**
|
| 28 |
+
|
| 29 |
+
- Use the system_prompt.txt for the System Prompt, this provides the
|
| 30 |
+
> accurate results.
|
| 31 |
+
|
| 32 |
+
- You can extract and edit the system prompt. I hope to add new
|
| 33 |
+
> functions later.
|
| 34 |
+
|
| 35 |
+
## **Capabilities**
|
| 36 |
+
|
| 37 |
+
MiniLLM Geometry Engine interprets geometry-related queries and outputs
|
| 38 |
+
functional Python code or mathematical expressions. For example, given a
|
| 39 |
+
prompt like \"Generate a function to calculate the area of a triangle,\"
|
| 40 |
+
it produces executable code or formulas with clear reasoning, leveraging
|
| 41 |
+
its CoT fine-tuning for logical accuracy. Supported tasks include area,
|
| 42 |
+
volume, distance, and intersection calculations.
|
| 43 |
+
|
| 44 |
+
## **Technical Details**
|
| 45 |
+
|
| 46 |
+
- **Architecture**: Transformer-based, inherited from TinyLlama 1.1B
|
| 47 |
+
|
| 48 |
+
- **Fine-Tuning Details**: Trained on a dataset of geometry problems
|
| 49 |
+
> with step-by-step solutions
|
| 50 |
+
|
| 51 |
+
- **Output Format**: Python code or pseudocode compatible with
|
| 52 |
+
> geometry engine APIs
|
| 53 |
+
|
| 54 |
+
- **Performance**: Improved accuracy on geometry tasks compared to the
|
| 55 |
+
> base TinyLlama model, with low latency
|
| 56 |
+
|
| 57 |
+
- **Model Storage**: Uses .safetensors for secure and efficient
|
| 58 |
+
> loading with Hugging Face\'s safetensors library
|
| 59 |
+
|
| 60 |
+
## **Usage**
|
| 61 |
+
|
| 62 |
+
To load and use the model with Hugging Face\'s Transformers library:
|
| 63 |
+
|
| 64 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
+
|
| 66 |
+
from safetensors.torch import load_file
|
| 67 |
+
|
| 68 |
+
\# Load tokenizer and model
|
| 69 |
+
|
| 70 |
+
tokenizer =
|
| 71 |
+
AutoTokenizer.from_pretrained(\"your-username/minillm-geometry-engine\")
|
| 72 |
+
|
| 73 |
+
model =
|
| 74 |
+
AutoModelForCausalLM.from_pretrained(\"your-username/minillm-geometry-engine\")
|
| 75 |
+
|
| 76 |
+
\# Example prompt
|
| 77 |
+
|
| 78 |
+
prompt = \"Draw a point A at 3,4\"
|
| 79 |
+
|
| 80 |
+
inputs = tokenizer(prompt, return_tensors=\"pt\")
|
| 81 |
+
|
| 82 |
+
outputs = model.generate(\*\*inputs, max_length=200)
|
| 83 |
+
|
| 84 |
+
print(tokenizer.decode(outputs\[0\], skip_special_tokens=True))
|
| 85 |
+
|
| 86 |
+
Install required libraries:
|
| 87 |
+
|
| 88 |
+
pip install safetensors transformers
|
| 89 |
+
|
| 90 |
+
## **Training Details**
|
| 91 |
+
|
| 92 |
+
- **Dataset**: Custom Geometry CoT dataset with 10,000 geometry
|
| 93 |
+
> problems and solutions
|
| 94 |
+
|
| 95 |
+
- **Training Procedure**: Fine-tuned for 3 epochs on a single NVIDIA
|
| 96 |
+
> A100 GPU
|
| 97 |
+
|
| 98 |
+
- **Hyperparameters**: Learning rate: 2e-5, batch size: 16
|
| 99 |
+
|
| 100 |
+
- **Hardware**: NVIDIA A100 GPU
|
| 101 |
+
|
| 102 |
+
## **Limitations**
|
| 103 |
+
|
| 104 |
+
- Supports very few functions since this was an experimental model,
|
| 105 |
+
> maybe I will add other functions later.
|
| 106 |
+
|
| 107 |
+
- Limited to geometry-related tasks and may not generalize to other
|
| 108 |
+
> mathematical domains.
|
| 109 |
+
|
| 110 |
+
- Extensive use of strict System Prompting. I aim to eliminate that
|
| 111 |
+
> also.
|
| 112 |
+
|
| 113 |
+
## **How to Contribute**
|
| 114 |
+
|
| 115 |
+
Submit issues or pull requests via the Hugging Face repository.
|
| 116 |
+
Contributions to the dataset or model improvements are welcome.
|
| 117 |
+
|
| 118 |
+
## **Acknowledgments**
|
| 119 |
+
|
| 120 |
+
Thanks to the TinyLlama team for the base model and Hugging Face for the
|
| 121 |
+
safetensors and transformers libraries.
|
| 122 |
+
|
| 123 |
+
MiniLLM Geometry Engine is a lightweight, efficient solution for
|
| 124 |
+
developers and researchers needing reliable geometry function
|
| 125 |
+
generation, with the security and performance benefits of the
|
| 126 |
+
.safetensors format.
|