You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: model2vec/train/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Training
2
2
3
-
Aside from [distillation](../../README.md#distillation), `model2vec` also supports training simple classifiers on top of static models, using [pytorch](https://pytorch.org/), [lightning](https://lightning.ai/) and [scikit-learn](https://scikit-learn.org/stable/index.html).
3
+
Aside from [distillation](../../README.md#distillation), `model2vec` also supports training simple classifiers on top of static models, using [pytorch](https://pytorch.org/) and [scikit-learn](https://scikit-learn.org/stable/index.html).
4
4
5
5
We support both single and multi-label classification, which work seamlessly based on the labels you provide.
6
6
@@ -53,7 +53,7 @@ print(classification_report)
53
53
54
54
As you can see, we got a pretty nice 91% accuracy, with only 81 seconds of training.
55
55
56
-
The training loop is handled by [`lightning`](https://pypi.org/project/lightning/). By default the training loop splits the data into a train and validation split, with 90% of the data being used for training and 10% for validation. By default, it runs with early stopping on the validation set accuracy, with a patience of 5.
56
+
The training loop is a plain PyTorch loop (see [`model2vec/train/trainer.py`](trainer.py)). By default the training loop splits the data into a train and validation split, with 90% of the data being used for training and 10% for validation. By default, it runs with early stopping on the validation set accuracy, with a patience of 5.
57
57
58
58
Note that this model is as fast as you're used to from us:
59
59
@@ -142,9 +142,9 @@ The core functionality of the `StaticModelForClassification` is contained in a c
142
142
*`train_test_split`: governs the train test split before classification.
143
143
*`prepare_dataset`: Selects the `torch.Dataset` that will be used in the `Dataloader` during training.
144
144
*`_encode`: The encoding function used in the model.
145
-
*`fit`: contains all the lightning-related fitting logic.
145
+
*`fit`: contains all the fitting logic.
146
146
147
-
The training of the model is done in a `lighting.LightningModule`, which can be modified but is very basic.
147
+
The training loop itself lives in `model2vec.train.trainer.run_training_loop`, a plain torch loop that is fairly basic and easy to modify. Each task passes in its own loss function (and, for classification, a small function that computes extra validation metrics like accuracy).
0 commit comments