    def set_all(self, freeze: bool = True):
        """
        Freeze/unfreeze all layers.

        Args:
            freeze (`bool`):
                if or not freeze layers (default: True)
        """
        for layer in self.model.children():
            for param in layer.parameters():
                param.requires_grad = not freeze
Freeze/unfreeze all layers.

Args:
freeze (`bool`):
if or not freeze layers (default: True)
towhee/trainer/utils/layer_freezer.py