(model)
| 247 | |
| 248 | # Used to verify DeepSpeed kernel injection worked with a model |
| 249 | def check_injection(model): |
| 250 | |
| 251 | def verify_injection(module): |
| 252 | for child in module.children(): |
| 253 | if isinstance(child, nn.ModuleList): |
| 254 | assert isinstance(child[0], DeepSpeedTransformerInference),\ |
| 255 | "DeepSpeed-Inference Transformer kernels has not been injected in the model" |
| 256 | break |
| 257 | else: |
| 258 | verify_injection(child) |
| 259 | |
| 260 | verify_injection(model) |
| 261 | |
| 262 | |
| 263 | # Used to Get Device name |
no test coverage detected