(model)
| 272 | |
| 273 | |
| 274 | def _get_layers(model): |
| 275 | if hasattr(model, "model") and hasattr(model.model, "layers"): |
| 276 | return model.model.layers |
| 277 | if hasattr(model, "language_model") and hasattr(model.language_model, "layers"): |
| 278 | return model.language_model.layers |
| 279 | if hasattr(model, "layers"): |
| 280 | return model.layers |
| 281 | raise AttributeError(f"Cannot find layers in {type(model).__name__}") |
| 282 | |
| 283 | |
| 284 | def _patch_model(model, layer_ids): |