Skip to content

Commit 2bd0062

Browse files
committed
move llm
1 parent 14a4c77 commit 2bd0062

12 files changed

Lines changed: 15 additions & 176 deletions

.github/copilot-instructions.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,6 @@ program_cache = ProgramCache("path/to/programs")
9696
program = program_cache.get_program(sequence_id)
9797
```
9898

99-
### Token Conversion Pattern:
100-
```python
101-
# Token conversion utilities
102-
from loda.ml.util import program_to_tokens, tokens_to_program
103-
104-
tokens, vocab = program_to_tokens(program)
105-
reconstructed = tokens_to_program(tokens)
106-
```
107-
10899
## Testing Conventions
109100

110101
- Use CSV files in `tests/operations/` for operation test cases
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pip install -r requirements.txt
6767
### 1. Prepare Training Data
6868

6969
```python
70-
from loda.ml.llm.data_preprocessing import create_dataset
70+
from loda.llm.data_preprocessing import create_dataset
7171

7272
# Create training dataset from OEIS programs
7373
dataset = create_dataset(
@@ -81,7 +81,7 @@ dataset = create_dataset(
8181
### 2. Train the Model
8282

8383
```python
84-
from loda.ml.llm.trainer import train_loda_llm
84+
from loda.llm.trainer import train_loda_llm
8585

8686
# Train the model
8787
model = train_loda_llm(
@@ -96,7 +96,7 @@ model = train_loda_llm(
9696

9797
Command line training:
9898
```bash
99-
python -m loda.ml.llm.trainer \
99+
python -m loda.llm.trainer \
100100
--programs_dir programs/oeis \
101101
--output_dir trained_model \
102102
--max_examples 10000 \
@@ -106,7 +106,7 @@ python -m loda.ml.llm.trainer \
106106
### 3. Generate Code
107107

108108
```python
109-
from loda.ml.llm.inference import load_model_for_inference
109+
from loda.llm.inference import load_model_for_inference
110110

111111
# Load trained model
112112
generator = load_model_for_inference("trained_model")
@@ -122,13 +122,13 @@ for result in results:
122122

123123
Interactive mode:
124124
```bash
125-
python -m loda.ml.llm.inference --mode interactive --model_path trained_model
125+
python -m loda.llm.inference --mode interactive --model_path trained_model
126126
```
127127

128128
### 4. Evaluate Performance
129129

130130
```python
131-
from loda.ml.llm.inference import evaluate_model
131+
from loda.llm.inference import evaluate_model
132132

133133
# Evaluate on test set
134134
metrics, results = evaluate_model("trained_model", "test_data.json")
@@ -276,7 +276,7 @@ Choose model size based on your requirements:
276276
Add new training examples:
277277

278278
```python
279-
from loda.ml.llm.data_preprocessing import TrainingExample
279+
from loda.llm.data_preprocessing import TrainingExample
280280

281281
custom_example = TrainingExample(
282282
sequence_id="custom_001",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- Evaluation metrics for generated programs
1414
1515
Example usage:
16-
>>> from loda.ml.llm import LodaT5Model, LodaGenerator, train_loda_llm
16+
>>> from loda.llm import LodaT5Model, LodaGenerator, train_loda_llm
1717
>>>
1818
>>> # Train a model
1919
>>> model = train_loda_llm("programs/oeis", "trained_model")
File renamed without changes.

loda/ml/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

loda/ml/util.py

Lines changed: 0 additions & 118 deletions
This file was deleted.

loda_llm_example.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import os
1515
import sys
1616
import tempfile
17-
from loda.ml.llm import (
17+
from loda.llm import (
1818
create_dataset,
1919
train_loda_llm,
2020
LodaGenerator,
@@ -123,7 +123,7 @@ def main():
123123
evaluator = LodaEvaluator(model)
124124

125125
# Use a subset of the training data as test data for demo
126-
from loda.ml.llm.data_preprocessing import DataPreprocessor
126+
from loda.llm.data_preprocessing import DataPreprocessor
127127
preprocessor = DataPreprocessor(programs_dir)
128128
test_examples = preprocessor.create_training_examples(max_examples=10)
129129

@@ -142,10 +142,13 @@ def main():
142142

143143
print("\n" + "=" * 50)
144144
print("Example completed!")
145-
print("\nTo use the LLM in your own code:")
145+
print("To use the LLM in your own code:")
146146
print("1. Train a model: train_loda_llm('programs/oeis', 'my_model')")
147147
print("2. Load for inference: generator = LodaGenerator.load_model('my_model')")
148148
print("3. Generate code: results = generator.generate('your description')")
149+
print("\nCommand line usage:")
150+
print("- Train: python -m loda.llm.trainer --programs_dir programs/oeis")
151+
print("- Interactive: python -m loda.llm.inference --mode interactive --model_path my_model")
149152

150153
return 0
151154

0 commit comments

Comments
 (0)