The indentation is wrong and you would have to add an indent to the code after the posted code snippet, so that it will be executed in the for phase loop.
Also, once this is fixed, you’ll run into the other error, since you are freezing all parameters of the model, so you might want to keep some parameters trainable.