-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add reduce transformer vocab plugin #3217
Merged
alanakbik
merged 7 commits into
master
from
reintroduce_transformer_smaller_training_vocab
Oct 23, 2023
Merged
add reduce transformer vocab plugin #3217
alanakbik
merged 7 commits into
master
from
reintroduce_transformer_smaller_training_vocab
Oct 23, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
2 times, most recently
from
April 30, 2023 13:34
167f0eb
to
976c925
Compare
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
from
July 17, 2023 14:42
976c925
to
1737471
Compare
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
from
August 7, 2023 15:37
1737471
to
2ef4187
Compare
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
from
October 2, 2023 09:33
2ef4187
to
8bff328
Compare
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
from
October 16, 2023 08:06
8bff328
to
f399f41
Compare
helpmefindaname
force-pushed
the
reintroduce_transformer_smaller_training_vocab
branch
from
October 23, 2023 14:43
f399f41
to
5c1e3de
Compare
Looks great, thanks for adding this @helpmefindaname! Tested locally and got a 25% increase in training speed for this script with from flair.data import Corpus
from flair.datasets import TREC_6
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import TextClassifier
from flair.trainers import ModelTrainer
# 1. get the corpus
corpus: Corpus = TREC_6()
# 2. what label do we want to predict?
label_type = "question_class"
# 3. create the label dictionary
label_dict = corpus.make_label_dictionary(label_type=label_type)
# 4. initialize transformer document embeddings (many models are available)
document_embeddings = TransformerDocumentEmbeddings("distilbert-base-uncased", fine_tune=True)
# 5. create the text classifier
classifier = TextClassifier(document_embeddings, label_dictionary=label_dict, label_type=label_type)
# 6. initialize trainer
trainer = ModelTrainer(classifier, corpus)
# 7. run training with fine-tuning
trainer.fine_tune(
"resources/taggers/question-classification-with-transformer",
reduce_transformer_vocab=True, # set this to False for slow version
learning_rate=5.0e-5,
mini_batch_size=4,
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.