Shinegupta commited on
Commit
fa440ed
·
verified ·
1 Parent(s): c4304be

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -29
README.md CHANGED
@@ -1,47 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # ShineMath: Mathematical Olympiad Language Model
2
 
3
- ShineMath is a custom-trained language model designed to assist with mathematical olympiad problems, reasoning, and solution generation. This model was fine-tuned for mathematical tasks and olympiad-style problem solving.
 
4
 
5
- ## Model Details
6
- - **Author:** [Shinegupta](https://huggingface.co/Shinegupta)
7
- - **Repository:** [Hugging Face Model Card](https://huggingface.co/Shinegupta/ShineMath)
8
- - **Files Included:**
9
- - adapter_model.safetensors
10
- - adapter_config.json
11
- - tokenizer.json
12
- - tokenizer_config.json
13
- - special_tokens_map.json
14
- - generation_config.json
15
- - chat_template.jinja
16
 
 
 
 
 
 
17
 
 
18
 
19
- ## Usage
20
- To use ShineMath with the Hugging Face Transformers library:
21
 
22
  ```python
 
23
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
 
 
 
24
 
25
- model_name = "Shinegupta/ShineMath"
26
- tokenizer = AutoTokenizer.from_pretrained(model_name)
27
- model = AutoModelForCausalLM.from_pretrained(model_name)
 
 
 
 
28
 
29
- prompt = "Solve: Let x^2 + y^2 = 1. Find the maximum value of x + y."
30
- inputs = tokenizer(prompt, return_tensors="pt")
31
- outputs = model.generate(**inputs, max_new_tokens=128)
 
32
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
33
  ```
34
 
35
- ## Applications
36
- - Solving and generating mathematical olympiad problems
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  - Step-by-step solution explanations
38
- - Mathematical reasoning and proof generation
39
 
40
- ## License
41
- See [LICENSE](LICENSE) for details.
42
 
43
- ## Citation
44
- If you use ShineMath in your research or projects, please cite the repository or link to the Hugging Face model card.
45
 
46
- ---
47
- For questions or contributions, please open an issue or discussion on the [Hugging Face model page](https://huggingface.co/Shinegupta/ShineMath).
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0 # Change if you have a different one; apache-2.0 is common for open models
3
+ base_model: meta-llama/Llama-3-8B # ← IMPORTANT: Replace with your ACTUAL base model (e.g. mistralai/Mistral-7B-Instruct-v0.3, Qwen/Qwen2-7B-Instruct, google/gemma-2-9b-it, etc.)
4
+ tags:
5
+ - peft
6
+ - lora
7
+ - text-generation
8
+ - mathematics
9
+ - math-reasoning
10
+ - mathematical-olympiad
11
+ - transformers
12
+ library_name: peft
13
+ pipeline_tag: text-generation
14
+ inference: false # Set to true later if you deploy it
15
+ ---
16
+
17
  # ShineMath: Mathematical Olympiad Language Model
18
 
19
+ ShineMath is a custom-trained **LoRA adapter** designed to assist with mathematical olympiad problems, reasoning, step-by-step solution generation, and proof writing.
20
+ It was fine-tuned for challenging math tasks using efficient PEFT methods.
21
 
22
+ **Author:** Shine Gupta (@shine_gupta17)
23
+ **Repository:** [Shinegupta/ShineMath](https://huggingface.co/Shinegupta/ShineMath)
 
 
 
 
 
 
 
 
 
24
 
25
+ ### Model Details
26
+ - **Type:** PEFT LoRA adapter (not a full model – load on top of a base LLM)
27
+ - **Files included:** adapter_model.safetensors, adapter_config.json, tokenizer files, chat_template.jinja, generation_config.json
28
+ - **Size:** ~82.5 MB (lightweight and easy to share/load)
29
+ - **Intended use:** Solving/generating IMO-style problems, AMC/AIME prep, mathematical reasoning, explanations
30
 
31
+ ### Usage (with PEFT + Transformers)
32
 
33
+ Since this is a LoRA adapter, load it **on top of the base model**:
 
34
 
35
  ```python
36
+ from peft import PeftModel
37
  from transformers import AutoModelForCausalLM, AutoTokenizer
38
+ import torch
39
+
40
+ base_model_name = "meta-llama/Llama-3-8B" # ← Replace with your actual base model!
41
+ adapter_name = "Shinegupta/ShineMath"
42
 
43
+ tokenizer = AutoTokenizer.from_pretrained(adapter_name)
44
+ model = AutoModelForCausalLM.from_pretrained(
45
+ base_model_name,
46
+ torch_dtype=torch.bfloat16, # or "auto"
47
+ device_map="auto"
48
+ )
49
+ model = PeftModel.from_pretrained(model, adapter_name)
50
 
51
+ # Example
52
+ prompt = "Solve: Let x² + y² = 1. Find the maximum value of x + y under the constraint x, y ≥ 0."
53
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
54
+ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
55
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
56
  ```
57
 
58
+ Simpler with pipeline (auto-handles adapter):
59
+
60
+ ```python
61
+ from transformers import pipeline
62
+
63
+ pipe = pipeline(
64
+ "text-generation",
65
+ model=base_model_name,
66
+ peft_model=adapter_name, # Loads the LoRA automatically
67
+ device_map="auto"
68
+ )
69
+
70
+ result = pipe("Prove by induction that the sum of the first n natural numbers is n(n+1)/2.")
71
+ print(result[0]["generated_text"])
72
+ ```
73
+
74
+ Tip: Use the chat_template.jinja for chat/instruct formats if your base model supports it (e.g., apply_chat_template).
75
+
76
+ ### Applications
77
+ - Solving and generating mathematical olympiad problems (IMO, AIME, AMC, etc.)
78
  - Step-by-step solution explanations
79
+ - Mathematical reasoning, theorem proving, and algebraic manipulations
80
 
81
+ ### License
82
+ See the LICENSE file or specify here (e.g., Apache-2.0 for open use).
83
 
84
+ ### Citation
85
+ If you use ShineMath in research or projects, please cite:
86
 
87
+ @misc{shinegupta2026_shinemath,
88
+ author = {Shine Gupta},
89
+ title = {ShineMath: Mathematical Olympiad Language Model},
90
+ year = {2026},
91
+ publisher = {Hugging Face},
92
+ howpublished = {\url{https://huggingface.co/Shinegupta/ShineMath}}
93
+ }
94
+
95
+ For questions, collaborations, or issues — open a discussion on the model page! Happy math solving!