- unshard() and full_tensor() are collective ops, all ranks must participate - Old code returned None on non-rank-0 before calling unshard, causing deadlock - Fix: all ranks unshard/full_tensor, only rank-0 keeps the result - Move create_ref_model to parallel/utils.py, accept executor+model directly - Guard create_ref_model and sync_old_model against None on non-rank-0
41 lines
865 B
Python
41 lines
865 B
Python
from astrai.parallel.executor import (
|
|
AccumOptimizer,
|
|
AccumScheduler,
|
|
BaseExecutor,
|
|
DDPExecutor,
|
|
ExecutorFactory,
|
|
FSDPExecutor,
|
|
GradientState,
|
|
NoneExecutor,
|
|
)
|
|
from astrai.parallel.module import ColumnParallelLinear, RowParallelLinear
|
|
from astrai.parallel.setup import (
|
|
get_current_device,
|
|
get_rank,
|
|
get_world_size,
|
|
only_on_rank,
|
|
setup_parallel,
|
|
spawn_parallel_fn,
|
|
)
|
|
from astrai.parallel.utils import create_ref_model
|
|
|
|
__all__ = [
|
|
"get_world_size",
|
|
"get_rank",
|
|
"get_current_device",
|
|
"only_on_rank",
|
|
"setup_parallel",
|
|
"spawn_parallel_fn",
|
|
"RowParallelLinear",
|
|
"ColumnParallelLinear",
|
|
"ExecutorFactory",
|
|
"BaseExecutor",
|
|
"GradientState",
|
|
"AccumOptimizer",
|
|
"AccumScheduler",
|
|
"NoneExecutor",
|
|
"DDPExecutor",
|
|
"FSDPExecutor",
|
|
"create_ref_model",
|
|
]
|