MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / _initialize_affine_weight_gpu

Function _initialize_affine_weight_gpu

codegeex/megatron/mpu/layers.py:83–95  ·  view source on GitHub ↗

Initialize affine weight for model parallel on GPU.

(weight, init_method, partition_dim, stride=1)

Source from the content-addressed store, hash-verified

81
82
83def _initialize_affine_weight_gpu(weight, init_method, partition_dim, stride=1):
84 """Initialize affine weight for model parallel on GPU."""
85
86 set_tensor_model_parallel_attributes(
87 tensor=weight, is_parallel=True, dim=partition_dim, stride=stride
88 )
89
90 if ds_checkpointing.is_configured():
91 global get_cuda_rng_tracker
92 get_cuda_rng_tracker = ds_checkpointing.get_cuda_rng_tracker
93
94 with get_cuda_rng_tracker().fork():
95 init_method(weight)
96
97
98def _initialize_affine_weight_cpu(

Callers 3

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls 3

get_cuda_rng_trackerFunction · 0.85
forkMethod · 0.80

Tested by

no test coverage detected