mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-25 17:10:51 +00:00
docs: Add ChainSum usage example to README
This commit is contained in:
parent
e8c3965299
commit
cfba2cb0d5
1 changed files with 44 additions and 0 deletions
44
README.md
44
README.md
|
|
@ -4,6 +4,50 @@ We are building a python library of procedural dataset generators and algorithmi
|
|||
|
||||
The goal is to generate virtually infinite data with adjustable complexity.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```python
|
||||
from reasoning_gym.arithmetic import ChainSum, ChainSumConfig
|
||||
|
||||
# Configure a simple arithmetic task generator
|
||||
config = ChainSumConfig(
|
||||
min_terms=2, # At least 2 numbers per expression
|
||||
max_terms=4, # At most 4 numbers per expression
|
||||
min_digits=1, # Single digit numbers
|
||||
max_digits=2, # Up to 2-digit numbers
|
||||
allow_negation=False, # Only positive numbers
|
||||
size=5, # Generate 5 examples
|
||||
seed=42 # For reproducibility
|
||||
)
|
||||
|
||||
# Create the dataset
|
||||
dataset = ChainSum(config)
|
||||
|
||||
# Generate some examples
|
||||
for i in range(len(dataset)):
|
||||
item = dataset[i]
|
||||
print(f"Question: {item['question']}")
|
||||
print(f"Answer: {item['answer']}\n")
|
||||
```
|
||||
|
||||
Example output:
|
||||
```
|
||||
Question: 7 + 42 - 15 =
|
||||
Answer: 34
|
||||
|
||||
Question: 91 - 8 =
|
||||
Answer: 83
|
||||
|
||||
Question: 4 + 67 - 12 =
|
||||
Answer: 59
|
||||
|
||||
Question: 28 + 35 =
|
||||
Answer: 63
|
||||
|
||||
Question: 51 - 24 + 7 =
|
||||
Answer: 34
|
||||
```
|
||||
|
||||
|
||||
### Generator / Environment Ideas
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue