rnajena / bertax_training

Training scripts for BERTax
8 stars 4 forks source link

Loading pre-trained model #6

Closed CompBioML closed 2 years ago

CompBioML commented 2 years ago

I find your taxonomic classifier really interesting but I was hoping to load in the model as a typical Keras model which I could edit (I.E for feature extraction purposes) but I noticed you used the Keras Bert package as a framework and the associated number of custom objects have made it difficult to load the model. I was wondering if you had a short script to load in the model, such that I can experiment with it. Thanks!

flomock commented 2 years ago

Which model do you want to load? The pretrained or the fine-tuned one? Either way, try this function if its works for you: https://github.com/f-kretschmer/bertax_training/blob/abc04c9fb8d33bec1ab95362f2ccab2e7447a2e8/models/bert_utils.py#L26

CompBioML commented 2 years ago

Thanks, that did the trick. BTW I loaded in the "big_trainingset_all_fix_classes_selection.h5" model as I could'nt find any others

f-kretschmer commented 2 years ago

Perfect, yes this model is the only one included right now.