ezpz.examples.cifar.train_dsΒΆ
CIFAR10 training example using DeepSpeed (optionally MoE).
Launch with:
1 | |
Help output (requires deepspeed installed; python3 -m ezpz.examples.cifar.train_ds --help may fail without it):
1 | |
Net
ΒΆ
Bases: Module
Convolutional network for CIFAR10 with optional MoE layers.
Source code in src/ezpz/examples/cifar/train_ds.py
__init__(args)
ΒΆ
Simple CNN for CIFAR10; optionally wraps MoE layers.
Source code in src/ezpz/examples/cifar/train_ds.py
forward(x)
ΒΆ
Forward pass through the CNN (with optional MoE blocks).
Source code in src/ezpz/examples/cifar/train_ds.py
add_argument()
ΒΆ
Build and parse command-line arguments for the CIFAR DeepSpeed demo.
Source code in src/ezpz/examples/cifar/train_ds.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
create_moe_param_groups(model)
ΒΆ
Create separate parameter groups for each expert.
Source code in src/ezpz/examples/cifar/train_ds.py
get_ds_config(args)
ΒΆ
Get the DeepSpeed configuration dictionary.
Source code in src/ezpz/examples/cifar/train_ds.py
main(args)
ΒΆ
Entrypoint: initialize DeepSpeed, load CIFAR10, train and evaluate.
Source code in src/ezpz/examples/cifar/train_ds.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | |
test(model_engine, testset, local_device, target_dtype, test_batch_size=4)
ΒΆ
Test the network on the test data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_engine
|
DeepSpeedEngine
|
the DeepSpeed engine. |
required |
testset
|
Dataset
|
the test dataset. |
required |
local_device
|
str
|
the local device name. |
required |
target_dtype
|
dtype
|
the target datatype for the test data. |
required |
test_batch_size
|
int
|
the test batch size. |
4
|