Hi Jeremy,
Good question! To change the frozen/unfrozen status of weights during training, you can do something like the following:
```js
// ...
onEochEnd: async (epoch, logs) => {
if (epoch === 3) {
model.layers[1].trainable = false;
model.compile({optimizer, loss}); // Do not forget to call compile() here!
}
}
```
The important thing to remember is to call model.compile() after you modify the trainable property of the layer(s) involved, because
the set of trainable weights is collected during the compile() call.
However, currently there seems to be a bug in tfjs which makes the above work only for non-sequential (a.k.a. "functional") models.
This doesn't work for sequential models yet. I've filed
a GitHub issue to track this bug. Thanks for raising this question.
Best,
Shanqing