Skip to content

Commit 808f749

Browse files
committed
fix: Fix argument order for training
fixes #45
1 parent 07cfca0 commit 808f749

6 files changed

Lines changed: 31 additions & 25 deletions

examples/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A simple binary sentiment classification example that covers:
1515
**Run the example:**
1616
```bash
1717
cd examples
18-
uv run python basic_classification.py
18+
uv run --extra huggingface python basic_classification.py
1919
```
2020

2121
**What you'll learn:**
@@ -34,7 +34,7 @@ Demonstrates 3-class sentiment analysis (positive, negative, neutral):
3434
**Run the example:**
3535
```bash
3636
cd examples
37-
uv run python multiclass_classification.py
37+
uv run --extra huggingface python multiclass_classification.py
3838
```
3939

4040
**What you'll learn:**
@@ -53,7 +53,7 @@ Shows how to combine text and categorical features:
5353
**Run the example:**
5454
```bash
5555
cd examples
56-
uv run python Using_additional_features.py
56+
uv run --extra huggingface python Using_additional_features.py
5757
```
5858

5959
**What you'll learn:**
@@ -72,7 +72,7 @@ Explores advanced training configurations:
7272
**Run the example:**
7373
```bash
7474
cd examples
75-
uv run python advanced_training.py
75+
uv run --extra huggingface python advanced_training.py
7676
```
7777

7878
**What you'll learn:**
@@ -93,10 +93,10 @@ Demonstrates model explainability with ASCII histogram visualizations:
9393
```bash
9494
cd examples
9595
# Regular mode - analyze predefined examples
96-
uv run python simple_explainability_example.py
96+
uv run --extra huggingface python simple_explainability_example.py
9797

9898
# Interactive mode - analyze your own text
99-
uv run python simple_explainability_example.py --interactive
99+
uv run --extra huggingface python simple_explainability_example.py --interactive
100100
```
101101

102102
**What you'll learn:**
@@ -111,19 +111,19 @@ uv run python simple_explainability_example.py --interactive
111111
To run any example:
112112

113113
1. **Install dependencies:**
114-
```bash
115-
uv sync
116-
```
114+
```bash
115+
uv sync
116+
```
117117

118118
2. **Navigate to examples directory:**
119-
```bash
120-
cd examples
121-
```
119+
```bash
120+
cd examples
121+
```
122122

123123
3. **Run an example:**
124-
```bash
125-
uv run python basic_classification.py
126-
```
124+
```bash
125+
uv --extra huggingface run python basic_classification.py
126+
```
127127

128128
## 📊 Example Outputs
129129

examples/advanced_training.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ def main():
130130
)
131131

132132
classifier.train(
133-
X_train, y_train, X_val, y_val,
133+
X_train, y_train,
134134
training_config=training_config,
135+
X_val=X_val, y_val=y_val,
135136
verbose=True
136137
)
137138

@@ -172,13 +173,13 @@ def main():
172173
lr=1e-3,
173174
patience_early_stopping=7,
174175
num_workers=0,
175-
cpu_run=False, # Don't override accelerator from trainer_params
176176
trainer_params=advanced_trainer_params
177177
)
178178

179179
advanced_classifier.train(
180-
X_train, y_train, X_val, y_val,
180+
X_train, y_train,
181181
training_config=advanced_training_config,
182+
X_val=X_val, y_val=y_val,
182183
verbose=True
183184
)
184185

@@ -206,14 +207,14 @@ def main():
206207
batch_size=16, # Larger batch size for CPU
207208
lr=1e-3,
208209
patience_early_stopping=3,
209-
cpu_run=False, # Don't override accelerator from trainer_params
210210
num_workers=0, # No multiprocessing for CPU
211211
trainer_params={'deterministic': True, 'accelerator': 'cpu'}
212212
)
213213

214214
cpu_classifier.train(
215-
X_train, y_train, X_val, y_val,
215+
X_train, y_train,
216216
training_config=cpu_training_config,
217+
X_val=X_val, y_val=y_val,
217218
verbose=True
218219
)
219220

@@ -257,8 +258,9 @@ def main():
257258
)
258259

259260
custom_classifier.train(
260-
X_train, y_train, X_val, y_val,
261+
X_train, y_train,
261262
training_config=custom_training_config,
263+
X_val=X_val, y_val=y_val,
262264
verbose=True
263265
)
264266

examples/basic_classification.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ def main():
130130
num_workers=0, # Use 0 for simple examples to avoid multiprocessing issues
131131
)
132132
classifier.train(
133-
X_train, y_train, X_val, y_val,
133+
X_train, y_train,
134134
training_config=training_config,
135+
X_val=X_val, y_val=y_val,
135136
verbose=True
136137
)
137138
print("✅ Training completed!")

examples/multiclass_classification.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def main():
128128
trainer_params={'deterministic': True}
129129
)
130130
classifier.train(
131-
X_train, y_train, X_val, y_val,
131+
X_train, y_train,
132132
training_config=training_config,
133+
X_val=X_val, y_val=y_val,
133134
verbose=True
134135
)
135136
print("✅ Training completed!")

examples/simple_explainability_example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ def main():
129129
trainer_params={'deterministic': True}
130130
)
131131
classifier.train(
132-
X_train, y_train, X_val, y_val,
132+
X_train, y_train,
133133
training_config=training_config,
134+
X_val=X_val, y_val=y_val,
134135
verbose=True
135136
)
136137
print("✅ Training completed!")

examples/using_additional_features.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ def train_and_evaluate_model(X, y, model_name, use_categorical=False, use_simple
170170
# Train model
171171
print(" 🎯 Training model...")
172172
classifier.train(
173-
X_train, y_train, X_val, y_val,
173+
X_train, y_train,
174174
training_config=training_config,
175+
X_val=X_val, y_val=y_val,
175176
verbose=True
176177
)
177178
training_time = time.time() - start_time

0 commit comments

Comments
 (0)