diff --git a/examples/README.md b/examples/README.md index 3c8e0ea..d727d62 100644 --- a/examples/README.md +++ b/examples/README.md @@ -15,7 +15,7 @@ A simple binary sentiment classification example that covers: **Run the example:** ```bash cd examples -uv run python basic_classification.py +uv run --extra huggingface python basic_classification.py ``` **What you'll learn:** @@ -34,7 +34,7 @@ Demonstrates 3-class sentiment analysis (positive, negative, neutral): **Run the example:** ```bash cd examples -uv run python multiclass_classification.py +uv run --extra huggingface python multiclass_classification.py ``` **What you'll learn:** @@ -53,7 +53,7 @@ Shows how to combine text and categorical features: **Run the example:** ```bash cd examples -uv run python Using_additional_features.py +uv run --extra huggingface python Using_additional_features.py ``` **What you'll learn:** @@ -72,7 +72,7 @@ Explores advanced training configurations: **Run the example:** ```bash cd examples -uv run python advanced_training.py +uv run --extra huggingface python advanced_training.py ``` **What you'll learn:** @@ -93,10 +93,10 @@ Demonstrates model explainability with ASCII histogram visualizations: ```bash cd examples # Regular mode - analyze predefined examples -uv run python simple_explainability_example.py +uv run --extra huggingface python simple_explainability_example.py # Interactive mode - analyze your own text -uv run python simple_explainability_example.py --interactive +uv run --extra huggingface python simple_explainability_example.py --interactive ``` **What you'll learn:** @@ -111,19 +111,19 @@ uv run python simple_explainability_example.py --interactive To run any example: 1. **Install dependencies:** - ```bash - uv sync - ``` +```bash +uv sync +``` 2. **Navigate to examples directory:** - ```bash - cd examples - ``` +```bash +cd examples +``` 3. **Run an example:** - ```bash - uv run python basic_classification.py - ``` +```bash +uv --extra huggingface run python basic_classification.py +``` ## 📊 Example Outputs diff --git a/examples/advanced_training.py b/examples/advanced_training.py index a1a21bb..03c48a7 100644 --- a/examples/advanced_training.py +++ b/examples/advanced_training.py @@ -130,8 +130,9 @@ def main(): ) classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=training_config, + X_val=X_val, y_val=y_val, verbose=True ) @@ -172,13 +173,13 @@ def main(): lr=1e-3, patience_early_stopping=7, num_workers=0, - cpu_run=False, # Don't override accelerator from trainer_params trainer_params=advanced_trainer_params ) advanced_classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=advanced_training_config, + X_val=X_val, y_val=y_val, verbose=True ) @@ -206,14 +207,14 @@ def main(): batch_size=16, # Larger batch size for CPU lr=1e-3, patience_early_stopping=3, - cpu_run=False, # Don't override accelerator from trainer_params num_workers=0, # No multiprocessing for CPU trainer_params={'deterministic': True, 'accelerator': 'cpu'} ) cpu_classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=cpu_training_config, + X_val=X_val, y_val=y_val, verbose=True ) @@ -257,8 +258,9 @@ def main(): ) custom_classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=custom_training_config, + X_val=X_val, y_val=y_val, verbose=True ) diff --git a/examples/basic_classification.py b/examples/basic_classification.py index 2d1de9d..695115d 100644 --- a/examples/basic_classification.py +++ b/examples/basic_classification.py @@ -130,8 +130,9 @@ def main(): num_workers=0, # Use 0 for simple examples to avoid multiprocessing issues ) classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=training_config, + X_val=X_val, y_val=y_val, verbose=True ) print("✅ Training completed!") diff --git a/examples/multiclass_classification.py b/examples/multiclass_classification.py index 8498e17..92e5d48 100644 --- a/examples/multiclass_classification.py +++ b/examples/multiclass_classification.py @@ -128,8 +128,9 @@ def main(): trainer_params={'deterministic': True} ) classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=training_config, + X_val=X_val, y_val=y_val, verbose=True ) print("✅ Training completed!") diff --git a/examples/simple_explainability_example.py b/examples/simple_explainability_example.py index 57bcadd..20cc1d5 100644 --- a/examples/simple_explainability_example.py +++ b/examples/simple_explainability_example.py @@ -129,8 +129,9 @@ def main(): trainer_params={'deterministic': True} ) classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=training_config, + X_val=X_val, y_val=y_val, verbose=True ) print("✅ Training completed!") diff --git a/examples/using_additional_features.py b/examples/using_additional_features.py index 854c0e4..90ab9b2 100644 --- a/examples/using_additional_features.py +++ b/examples/using_additional_features.py @@ -170,8 +170,9 @@ def train_and_evaluate_model(X, y, model_name, use_categorical=False, use_simple # Train model print(" 🎯 Training model...") classifier.train( - X_train, y_train, X_val, y_val, + X_train, y_train, training_config=training_config, + X_val=X_val, y_val=y_val, verbose=True ) training_time = time.time() - start_time