(config)
| 62 | |
| 63 | |
| 64 | def _engine(config): |
| 65 | torch.manual_seed(0) |
| 66 | model = Net() |
| 67 | named = list(model.named_parameters()) |
| 68 | # Weights with weight decay and biases without, as most training scripts set them up. |
| 69 | params = [ |
| 70 | dict(params=[p for n, p in named if n.endswith("weight")]), |
| 71 | dict(params=[p for n, p in named if n.endswith("bias")], weight_decay=0.0) |
| 72 | ] |
| 73 | engine, _, _, _ = deepspeed.initialize(model=model, model_parameters=params, config=config) |
| 74 | return engine |
| 75 | |
| 76 | |
| 77 | def _train(engine, steps, first_step=0): |
no test coverage detected