MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / _add_memoryopt_args

Function _add_memoryopt_args

DeepSpeedExample/megatron/arguments.py:576–595  ·  view source on GitHub ↗

Memory optimization arguments.

(parser)

Source from the content-addressed store, hash-verified

574 return parser
575
576def _add_memoryopt_args(parser):
577 """Memory optimization arguments."""
578
579 group = parser.add_argument_group('Memory optimizations', 'configurations')
580 group.add_argument("--scattered-embeddings", action='store_true',
581 help='Save memory by scattering embedding activations. '
582 'Introduces dropout differences across MP configurations.')
583 group.add_argument("--split-transformers", action='store_true',
584 help='Save memory by splitting transformer layers into two parts, '
585 'allowing for more frequent activation checkpoint savings.')
586 group.add_argument("--memory-centric-tiled-linear", action="store_true",
587 help='Save memory by tiling with deepspeed.zero.TiledLinear.')
588 group.add_argument("--tile-factor", type=int, default=1,
589 help='Make all linear layers the same size of [hidden/tile_factor, hidden/tile_factor]. '
590 'Must be enabled with --memory-centric-tiled-linear. '
591 'Example A: if tile_factor=1, the qkv layer [hidden, 3* hidden] would be converted into [1,3] tiles of size [hidden,hidden]. '
592 'Example B: if tile_factor=2, the intermediate layer [4*hidden, hidden] will be converted into [8, 2] tiles of size [hidden/2, hidden/2]. '
593 'Default is 1.')
594
595 return parser
596
597
598

Callers 1

parse_argsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected