(teacher_layers: nn.ModuleList, student_layers: nn.ModuleList, layers_to_copy: List)
| 15 | |
| 16 | |
| 17 | def copy_layers(teacher_layers: nn.ModuleList, student_layers: nn.ModuleList, layers_to_copy: List) -> None: |
| 18 | layers_to_copy = nn.ModuleList([l for i, l in enumerate(teacher_layers) if i in layers_to_copy]) |
| 19 | assert len(student_layers) == len(layers_to_copy), f"{len(student_layers)} != {len(layers_to_copy)}" |
| 20 | student_layers.load_state_dict(layers_to_copy.state_dict()) |
no outgoing calls
no test coverage detected