deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.13k stars 655 forks source link

Freeze a block for training #392

Closed ElieFrancis1 closed 3 years ago

ElieFrancis1 commented 3 years ago

Question

Is there a way to freeze a block for transfer learning ? something similar to Keras trainable = False ?

lanking520 commented 3 years ago

Currently, DJL is hard to achieve that, but it is possible to use a Predictor from the block in your application. You can checkout my use case from the Amazon Review https://github.com/awslabs/djl/blob/master/jupyter/rank_classification_using_BERT_on_Amazon_Review.ipynb . The wordEmbedding is a BERT layer not used for training.

ElieFrancis1 commented 3 years ago

Thanks