repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_llama.py
tests/test_shardformer/test_model/test_shard_llama.py
import os import pytest import torch import torch.distributed as dist from torch.testing import assert_close import colossalai from colossalai.logging import disable_existing_loggers from colossalai.pipeline.schedule.v_schedule import PipelineGraph from colossalai.shardformer import PipelineGradientCheckpointConfig f...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_sam.py
tests/test_shardformer/test_model/test_shard_sam.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.testing import ( assert_hf_output_close, clear_cache_before_run, parameterize, rerun_if_address_is_in_use, spawn, ) from tests.kit.model_zoo import model_zoo from tests.test_shardfor...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_qwen2.py
tests/test_shardformer/test_model/test_shard_qwen2.py
import os import pytest import torch import transformers import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, paramete...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_whisper.py
tests/test_shardformer/test_model/test_shard_whisper.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_deepseek_v3.py
tests/test_shardformer/test_model/test_shard_deepseek_v3.py
from typing import Tuple import pytest import torch import torch.distributed import torch.distributed as dist from torch.testing import assert_close import colossalai from colossalai.booster.plugin import MoeHybridParallelPlugin from colossalai.booster.plugin.moe_hybrid_parallel_plugin import MoeHybridParallelPlugin ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_falcon.py
tests/test_shardformer/test_model/test_shard_falcon.py
import pytest import torch import torch.distributed as dist import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parame...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_gptj.py
tests/test_shardformer/test_model/test_shard_gptj.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_t5.py
tests/test_shardformer/test_model/test_shard_t5.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_bert.py
tests/test_shardformer/test_model/test_shard_bert.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_mixtral.py
tests/test_shardformer/test_model/test_shard_mixtral.py
import os import shutil from copy import deepcopy from typing import Tuple import pytest import torch import torch.distributed import torch.distributed as dist from transformers.models.mixtral.configuration_mixtral import MixtralConfig from transformers.models.mixtral.modeling_mixtral import MixtralModel import colos...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_qwen3.py
tests/test_shardformer/test_model/test_shard_qwen3.py
import pytest import torch import transformers import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_command.py
tests/test_shardformer/test_model/test_shard_command.py
import os import pytest import torch import torch.distributed as dist from torch.testing import assert_close import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer import PipelineGradientCheckpointConfig from colossalai.shardformer.layer.utils import Randomizer from colo...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_deepseek.py
tests/test_shardformer/test_model/test_shard_deepseek.py
import os import shutil from copy import deepcopy from typing import Tuple import pytest import torch import torch.distributed import torch.distributed as dist from transformers import AutoConfig, AutoModel import colossalai from colossalai.booster.booster import Booster from colossalai.booster.plugin.moe_hybrid_para...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_vit.py
tests/test_shardformer/test_model/test_shard_vit.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_opt.py
tests/test_shardformer/test_model/test_shard_opt.py
import os import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_addre...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_bloom.py
tests/test_shardformer/test_model/test_shard_bloom.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_gpt2.py
tests/test_shardformer/test_model/test_shard_gpt2.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_chatglm2.py
tests/test_shardformer/test_model/test_shard_chatglm2.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_us...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/__init__.py
tests/test_shardformer/test_model/__init__.py
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_blip2.py
tests/test_shardformer/test_model/test_shard_blip2.py
import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.testing import ( assert_hf_output_close, clear_cache_before_run, parameterize, rerun_if_address_is_in_use, spawn, ) from tests.kit.model_zoo import model_zoo from tests.test_shardfor...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/test_shard_mistral.py
tests/test_shardformer/test_model/test_shard_mistral.py
import os import pytest import torch import colossalai from colossalai.logging import disable_existing_loggers from colossalai.shardformer.layer.utils import Randomizer from colossalai.tensor.d_tensor.api import clear_layout_converter from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_addre...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_shardformer/test_model/_utils.py
tests/test_shardformer/test_model/_utils.py
import copy from contextlib import nullcontext from typing import Any, Callable, Dict, List, Optional, Type import torch import torch.distributed as dist from torch import Tensor from torch import distributed as dist from torch.distributed import ProcessGroup from torch.nn import Module from torch.optim import Adam, O...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/__init__.py
tests/kit/__init__.py
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/registry.py
tests/kit/model_zoo/registry.py
#!/usr/bin/env python from dataclasses import dataclass from typing import Callable, List, Union __all__ = ["ModelZooRegistry", "ModelAttribute", "model_zoo"] @dataclass class ModelAttribute: """ Attributes of a model. Args: has_control_flow (bool): Whether the model contains branching in its fo...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/executor.py
tests/kit/model_zoo/executor.py
from typing import Callable, Dict, Optional, Union import torch from torch.nn import Module from torch.optim import Optimizer from colossalai.interface import OptimizerWrapper def run_fwd( model: Module, data: Dict, output_transform_fn: Callable, criterion: Optional[Callable] = None ) -> torch.Tensor: """ru...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/__init__.py
tests/kit/model_zoo/__init__.py
import os from . import custom, diffusers, timm, torchaudio, torchvision, transformers from .executor import run_fwd, run_fwd_bwd from .registry import model_zoo # We pick a subset of models for fast testing in order to reduce the total testing time COMMON_MODELS = [ "custom_hanging_param_model", "custom_nest...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/simple_net.py
tests/kit/model_zoo/custom/simple_net.py
import torch import torch.nn as nn import torch.nn.functional as F from ..registry import model_zoo from .base import CheckpointModule class SimpleNet(CheckpointModule): """ In this no-leaf module, it has subordinate nn.modules and a nn.Parameter. """ def __init__(self, checkpoint=False) -> None: ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/hanging_param_model.py
tests/kit/model_zoo/custom/hanging_param_model.py
import torch import torch.nn as nn import torch.nn.functional as F from ..registry import model_zoo from .base import CheckpointModule class HangingParamModule(CheckpointModule): """ Hanging Parameter: a parameter dose not belong to a leaf Module. It has subordinate nn.modules and a nn.Parameter. """...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/nested_model.py
tests/kit/model_zoo/custom/nested_model.py
import torch import torch.nn as nn import torch.nn.functional as F from ..registry import model_zoo from .base import CheckpointModule class SubNet(nn.Module): def __init__(self, out_features) -> None: super().__init__() self.bias = nn.Parameter(torch.zeros(out_features)) def forward(self, x...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/repeated_computed_layers.py
tests/kit/model_zoo/custom/repeated_computed_layers.py
import torch import torch.nn as nn import torch.nn.functional as F from ..registry import model_zoo from .base import CheckpointModule class NetWithRepeatedlyComputedLayers(CheckpointModule): """ This model is to test with layers which go through forward pass multiple times. In this model, the fc1 and fc...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/__init__.py
tests/kit/model_zoo/custom/__init__.py
from .hanging_param_model import * from .nested_model import * from .repeated_computed_layers import * from .simple_mlp import * from .simple_net import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/base.py
tests/kit/model_zoo/custom/base.py
import torch.nn as nn from torch.utils.checkpoint import checkpoint class CheckpointModule(nn.Module): def __init__(self, checkpoint: bool = False): super().__init__() self.checkpoint = checkpoint self._use_checkpoint = checkpoint def _forward(self, *args, **kwargs): raise Not...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/custom/simple_mlp.py
tests/kit/model_zoo/custom/simple_mlp.py
from copy import deepcopy import torch import torch.nn as nn from colossalai.shardformer.layer import Linear1D_Col, Linear1D_Row from ..registry import model_zoo _BS = 16 _IN_DIM = 32 _HID_DIM = 128 class Net(nn.Module): def __init__(self, in_dim=_IN_DIM, hid_dim=_HID_DIM, identity=True, dtype=torch.float32):...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchrec/torchrec.py
tests/kit/model_zoo/torchrec/torchrec.py
from functools import partial import torch from torchrec.models import deepfm, dlrm from torchrec.modules.embedding_configs import EmbeddingBagConfig from torchrec.modules.embedding_modules import EmbeddingBagCollection from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, KeyedTensor from ..registry import mo...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchrec/__init__.py
tests/kit/model_zoo/torchrec/__init__.py
from .torchrec import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/diffusers/diffusers.py
tests/kit/model_zoo/diffusers/diffusers.py
from functools import partial import diffusers import torch import transformers from ..registry import model_zoo BATCH_SIZE = 2 SEQ_LENGTH = 5 HEIGHT = 224 WIDTH = 224 IN_CHANNELS = 3 LATENTS_SHAPE = (BATCH_SIZE, IN_CHANNELS, HEIGHT // 7, WIDTH // 7) TIME_STEP = 3 data_vae_fn = lambda: dict(sample=torch.randn(2, 3,...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/diffusers/__init__.py
tests/kit/model_zoo/diffusers/__init__.py
from .diffusers import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/timm/timm.py
tests/kit/model_zoo/timm/timm.py
import timm.models as tm import torch from ..registry import ModelAttribute, model_zoo ## ============== # Register models without control flow ## ============== data_gen_fn = lambda: dict(x=torch.rand(2, 3, 224, 224)) output_transform_fn = lambda x: dict(output=x) model_zoo.register( name="timm_resnet", model_f...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/timm/__init__.py
tests/kit/model_zoo/timm/__init__.py
from .timm import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/opt.py
tests/kit/model_zoo/transformers/opt.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence OPT # =============================== BATCH_SIZE = 2 SEQ_LENGTH = 16 def data_gen(): input_ids = torch.Tensor([[1, 15043, 29892, 590, 11203, 338, 274, 1082]]).long() ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/qwen2.py
tests/kit/model_zoo/transformers/qwen2.py
import torch import transformers from ..registry import ModelAttribute, model_zoo try: from transformers import Qwen2Config HAS_QWEN2 = True except ImportError: HAS_QWEN2 = False if HAS_QWEN2: # =============================== # Register Qwen2 # =============================== def data_...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/gpt.py
tests/kit/model_zoo/transformers/gpt.py
import copy import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence GPT # =============================== def data_gen(): # Generated from following code snippet # # from transformers import GPT2Tokenizer # input...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/deepseek.py
tests/kit/model_zoo/transformers/deepseek.py
# modified from tests/kit/model_zoo/transformers/mistral.py import torch import transformers from transformers import AutoConfig from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence Mixtral # =============================== def data_gen(): # Generated fro...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/bert.py
tests/kit/model_zoo/transformers/bert.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence BERT # =============================== # define data gen function def data_gen(): # Generated from following code snippet # # from transformers import BertTokeni...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/t5.py
tests/kit/model_zoo/transformers/t5.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence T5 # =============================== # define data gen function def data_gen_for_encoder_only(): # Generated from following code snippet # # from transformers im...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/whisper.py
tests/kit/model_zoo/transformers/whisper.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence Whisper # =============================== # define data gen function def data_gen(): # Generated from following code snippet # # from transformers import AutoFea...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/llama.py
tests/kit/model_zoo/transformers/llama.py
import torch import transformers from ..registry import ModelAttribute, model_zoo try: from transformers import LlamaConfig HAS_LLAMA = True except ImportError: HAS_LLAMA = False if HAS_LLAMA: # =============================== # Register LLaMA # =============================== def data_...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/vit.py
tests/kit/model_zoo/transformers/vit.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence VIT # =============================== config = transformers.ViTConfig(num_hidden_layers=4, hidden_size=128, intermediate_size=256, num_attention_heads=4) # define data gen ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/falcon.py
tests/kit/model_zoo/transformers/falcon.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register Falcon # =============================== def data_gen(): # Generated from following code snippet # # from transformers import AutoTokenizer # input = 'Hello, my dog is cute'...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/chatglm2.py
tests/kit/model_zoo/transformers/chatglm2.py
import torch from torch.nn import init from transformers import AutoConfig, AutoModelForCausalLM from ..registry import ModelAttribute, model_zoo # ================================ # Register single-sentence ChatGLM # ================================ def data_gen(): input_ids = torch.tensor([[5941, 15, 2670, 35...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/qwen3.py
tests/kit/model_zoo/transformers/qwen3.py
import torch import transformers from ..registry import ModelAttribute, model_zoo try: from transformers import Qwen3Config HAS_QWEN3 = True except ImportError: HAS_QWEN3 = False if HAS_QWEN3: # =============================== # Register Qwen3 # =============================== def data_...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/gptj.py
tests/kit/model_zoo/transformers/gptj.py
import copy import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence GPT # =============================== def data_gen(): # Generated from following code snippet # # from transformers import AutoTokenizer # input...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/bloom.py
tests/kit/model_zoo/transformers/bloom.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register Bloom # =============================== def data_gen(): # Generated from following code snippet # # from transformers import BloomTokenizer # input = 'Hello, my dog is cute'...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/command.py
tests/kit/model_zoo/transformers/command.py
import torch import transformers from ..registry import ModelAttribute, model_zoo try: from transformers import CohereConfig HAS_COMMAND = True except ImportError: HAS_COMMAND = False if HAS_COMMAND: # =============================== # Register Command-R # =============================== ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/deepseek_v3.py
tests/kit/model_zoo/transformers/deepseek_v3.py
# modified from tests/kit/model_zoo/transformers/mistral.py from types import MethodType import torch import transformers from transformers import AutoConfig # =============================== # Register single-sentence Mixtral # =============================== def data_gen(): # Generated from following code sni...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/blip2.py
tests/kit/model_zoo/transformers/blip2.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-image SAM # =============================== # define data gen function def data_gen(): # Generated from following code snippet # # from PIL import Image # import requ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/sam.py
tests/kit/model_zoo/transformers/sam.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-image SAM # =============================== # define data gen function def data_gen(): # Generated from following code snippet # # from PIL import Image # import requ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/albert.py
tests/kit/model_zoo/transformers/albert.py
import torch import transformers from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence ALBERT # =============================== BATCH_SIZE = 2 SEQ_LENGTH = 16 def data_gen_fn(): input_ids = torch.zeros((BATCH_SIZE, SEQ_LENGTH), dtype=torch.int64) token...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/__init__.py
tests/kit/model_zoo/transformers/__init__.py
from .albert import * from .bert import * from .blip2 import * from .bloom import * from .chatglm2 import * from .command import * from .deepseek import * from .falcon import * from .gpt import * from .gptj import * from .llama import * from .mistral import * from .mixtral import * from .opt import * from .qwen2 import...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/mixtral.py
tests/kit/model_zoo/transformers/mixtral.py
# modified from tests/kit/model_zoo/transformers/mistral.py import torch import transformers from transformers import MixtralConfig from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence Mixtral # =============================== def data_gen(): # Generated ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/transformers/mistral.py
tests/kit/model_zoo/transformers/mistral.py
import torch import transformers from transformers import MistralConfig from ..registry import ModelAttribute, model_zoo # =============================== # Register single-sentence Mistral # =============================== def data_gen(): # Generated from following code snippet # # from transformers im...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchvision/__init__.py
tests/kit/model_zoo/torchvision/__init__.py
from .torchvision import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchvision/torchvision.py
tests/kit/model_zoo/torchvision/torchvision.py
import torch import torchvision import torchvision.models as tm from packaging import version from ..registry import ModelAttribute, model_zoo data_gen_fn = lambda: dict(x=torch.rand(4, 3, 224, 224)) output_transform_fn = lambda x: dict(output=x) # special data gen fn inception_v3_data_gen_fn = lambda: dict(x=torch....
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchaudio/torchaudio.py
tests/kit/model_zoo/torchaudio/torchaudio.py
from functools import partial import torch import torchaudio.models as tm from ..registry import ModelAttribute, model_zoo INPUT_DIM = 80 IN_FEATURES = 16 N_TIME = 20 KERNEL_SIZE = 5 HOP_LENGTH = 20 N_CLASSES = 10 N_FREQ = 16 N_MELS = 80 def conformer_data_gen_fn(): lengths = torch.randint(1, 400, (4,)) in...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/kit/model_zoo/torchaudio/__init__.py
tests/kit/model_zoo/torchaudio/__init__.py
from .torchaudio import *
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_all_to_all_single.py
tests/test_fp8/test_all_to_all_single.py
import torch import torch.distributed as dist from torch.distributed.distributed_c10d import _get_default_group from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import all_to_all_single_fp8 from colossalai.testing i...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_allgather.py
tests/test_fp8/test_fp8_allgather.py
import torch import torch.distributed as dist from torch.distributed.distributed_c10d import _get_default_group from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import _all_gather_fp8 from colossalai.testing import ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_reduce_scatter.py
tests/test_fp8/test_fp8_reduce_scatter.py
import torch from torch.distributed import reduce_scatter from torch.distributed.distributed_c10d import _get_default_group from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import reduce_scatter_fp8 from colossalai....
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_all_to_all.py
tests/test_fp8/test_fp8_all_to_all.py
import torch import torch.distributed as dist from torch.distributed.distributed_c10d import _get_default_group from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import _all_to_all_fp8 from colossalai.testing import ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_fsdp_comm_hook.py
tests/test_fp8/test_fp8_fsdp_comm_hook.py
import pytest import torch import torch.distributed as dist import torch.nn as nn import torch.optim as optim from packaging import version from torch.distributed.fsdp import FullyShardedDataParallel as FSDP from torch.testing import assert_close from colossalai import launch from colossalai.testing import clear_cache...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_all_to_all_single.py
tests/test_fp8/test_fp8_all_to_all_single.py
import torch import torch.distributed as dist from torch.distributed.distributed_c10d import _get_default_group from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import all_to_all_single_fp8 from colossalai.testing i...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_cast.py
tests/test_fp8/test_fp8_cast.py
import torch from torch.testing import assert_close from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import cast_from_fp8, cast_from_fp8_pipeline, cast_to_fp8, cast_to_fp8_pipeline from colossalai.testing import clear_cache_before_run, parameterize @clear_cache_before_run() @parame...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_hook.py
tests/test_fp8/test_fp8_hook.py
import pytest import torch import torch.nn as nn import torch.nn.functional as F from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import linear_fp8 from colossalai.quantization.fp8_hook import FP8Hook from colossalai.tensor.colo_parameter import ColoParameter from colossalai.tensor.p...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_ddp_comm_hook.py
tests/test_fp8/test_fp8_ddp_comm_hook.py
import os import torch import torch.distributed as dist import torch.multiprocessing as mp import torch.nn as nn import torch.optim as optim from torch.nn.parallel import DistributedDataParallel as DDP from torch.testing import assert_close # example modified from https://pytorch.org/tutorials/intermediate/ddp_tutori...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_allreduce.py
tests/test_fp8/test_fp8_allreduce.py
import torch import torch.distributed as dist from torch.testing import assert_close from colossalai import launch from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import all_reduce_fp8 from colossalai.testing import clear_cache_before_run, parameterize, rerun_if_address_is_in_use, s...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_fp8/test_fp8_linear.py
tests/test_fp8/test_fp8_linear.py
import pytest import torch import torch.nn.functional as F from torch.testing import assert_close from colossalai.accelerator import get_accelerator from colossalai.quantization.fp8 import linear_fp8 from colossalai.utils import get_current_device D_IN, D_OUT = 16, 32 B, S = 2, 64 DTYPE = torch.bfloat16 @pytest.mar...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_comm/test_object_list_p2p_v2.py
tests/test_legacy/test_comm/test_object_list_p2p_v2.py
import pytest import torch from colossalai.legacy.communication.p2p_v2 import recv_backward, recv_forward, send_backward, send_forward from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.legacy.initialize import launch from colossalai.logging impo...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_comm/test_object_list_p2p.py
tests/test_legacy/test_comm/test_object_list_p2p.py
import pytest import torch from colossalai.legacy.communication.p2p import ( recv_backward, recv_forward, send_backward, send_backward_recv_forward, send_forward, send_forward_recv_backward, ) from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context a...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_comm/test_boardcast_send_recv_v2.py
tests/test_legacy/test_comm/test_boardcast_send_recv_v2.py
import pytest import torch from colossalai.legacy.communication.p2p_v2 import _recv_object, _send_object from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.legacy.initialize import launch from colossalai.logging import disable_existing_loggers fr...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_comm/test_comm.py
tests/test_legacy/test_comm/test_comm.py
import pytest import torch import torch.distributed as dist from colossalai.accelerator import get_accelerator from colossalai.legacy.communication import all_gather, all_reduce, reduce_scatter from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.l...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_trainer/test_trainer_with_non_pipe_schedule.py
tests/test_legacy/test_trainer/test_trainer_with_non_pipe_schedule.py
import pytest import torch import colossalai from colossalai.legacy.amp.amp_type import AMP_TYPE from colossalai.legacy.trainer import Trainer from colossalai.logging import get_dist_logger from colossalai.testing import DummyDataloader, parameterize, rerun_if_address_is_in_use, spawn from colossalai.utils import Mult...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_trainer/test_trainer_with_pipe_schedule.py
tests/test_legacy/test_trainer/test_trainer_with_pipe_schedule.py
import os from pathlib import Path import pytest import torch import torch.nn as nn from torch.optim import Adam from torchvision import transforms from torchvision.datasets import CIFAR10 from torchvision.models import resnet18 import colossalai from colossalai.legacy.context.parallel_mode import ParallelMode from c...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_trainer/test_pipeline/test_pipeline_schedule.py
tests/test_legacy/test_trainer/test_pipeline/test_pipeline_schedule.py
# referenced from Megatron and used to testify communication import os from pathlib import Path import pytest import torch import torch.nn as nn from torchvision import transforms from torchvision.datasets import CIFAR10 from torchvision.models import resnet18 import colossalai from colossalai.legacy.context import ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_trainer/test_pipeline/test_p2p.py
tests/test_legacy/test_trainer/test_pipeline/test_p2p.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- import pytest import torch import torch.distributed as dist from colossalai.accelerator import get_accelerator from colossalai.legacy.communication import ( recv_backward, recv_forward, send_backward, send_backward_recv_forward, send_forward, sen...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_cuda_rpc_value_correctness.py
tests/test_legacy/test_pipeline/test_cuda_rpc_value_correctness.py
import torch from rpc_test_utils import RpcTestModel, parse_args, rpc_run from torch import autograd, nn from colossalai.legacy.pipeline.rpc._pipeline_schedule import OneFOneBPipelineEngine from colossalai.testing import assert_close feat_num = 100 h = 100 def partition(pp_rank: int, chunk: int, stage_num: int): ...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_pipelinable.py
tests/test_legacy/test_pipeline/test_pipelinable.py
import pytest import torch from colossalai.legacy.pipeline.pipelinable import PipelinableContext from colossalai.testing import rerun_if_address_is_in_use, spawn NUM_CHUNKS = 1 PIPELINE_SIZE = 2 class MLP(torch.nn.Module): def __init__(self, dim: int = 256): super().__init__() intermediate_dim =...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_cuda_rpc_chimera.py
tests/test_legacy/test_pipeline/test_cuda_rpc_chimera.py
import torch import torch.autograd as autograd from rpc_test_utils import RpcTestModel, parse_args, rpc_run from torch import nn from colossalai.legacy.pipeline.rpc import ChimeraPipelineEngine # global variable for model created feat_num = 100 h = 100 def partition(pp_rank: int, chunk: int, stage_num: int): to...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_cuda_rpc_pipeline.py
tests/test_legacy/test_pipeline/test_cuda_rpc_pipeline.py
import torch from rpc_test_utils import RpcTestModel, parse_args, rpc_run from colossalai.legacy.pipeline.rpc._pipeline_schedule import OneFOneBPipelineEngine # global variable for model created feat_num = 100 h = 100 def partition(pp_rank: int, chunk: int, stage_num: int): torch.manual_seed(1024) partition...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_pipeline_process_group.py
tests/test_legacy/test_pipeline/test_pipeline_process_group.py
import os import torch.distributed.rpc as rpc from rpc_test_utils import pg_parse_args, rpc_is_initialized from colossalai.legacy.initialize import launch from colossalai.legacy.pipeline.pipeline_process_group import ppg from colossalai.logging import disable_existing_loggers from colossalai.testing import spawn de...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/rpc_test_utils.py
tests/test_legacy/test_pipeline/rpc_test_utils.py
import argparse import os import warnings import torch import torch.distributed.rpc as rpc import torch.multiprocessing as mp from torch import nn from torch._C._distributed_rpc import _is_current_rpc_agent_set from colossalai.legacy import launch from colossalai.legacy.pipeline.pipeline_process_group import ppg from...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_cuda_rpc_optimizer.py
tests/test_legacy/test_pipeline/test_cuda_rpc_optimizer.py
import torch from rpc_test_utils import RpcTestModel, parse_args, rpc_run from torch import autograd, nn from torch.optim import Optimizer from colossalai.legacy.pipeline.rpc._pipeline_schedule import OneFOneBPipelineEngine from colossalai.testing import assert_close # global variable for model created feat_num = 100...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_pipeline/test_middleware_1f1b.py
tests/test_legacy/test_pipeline/test_middleware_1f1b.py
import os from functools import partial import pytest import torch import torch.distributed.rpc as rpc from rpc_test_utils import DAG_MLP, MLP from torch._C._distributed_rpc import _is_current_rpc_agent_set from colossalai.fx import ColoTracer from colossalai.fx.passes.adding_split_node_pass import balanced_split_pas...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_cache_embedding.py
tests/test_legacy/test_layers/test_cache_embedding.py
import random from typing import List import numpy as np import pytest import torch import colossalai from colossalai.legacy.nn.parallel.layers import ( CachedEmbeddingBag, CachedParamMgr, EvictionStrategy, ParallelCachedEmbeddingBag, ParallelCachedEmbeddingBagTablewise, TablewiseEmbeddingBagC...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_1d/test_1d.py
tests/test_legacy/test_layers/test_1d/test_1d.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- import pytest import torch from checks_1d.check_layer_1d import * from colossalai.legacy.core import global_context as gpc from colossalai.legacy.initialize import launch from colossalai.logging import disable_existing_loggers from colossalai.testing import rerun_if_add...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_1d/checks_1d/common.py
tests/test_legacy/test_layers/test_1d/checks_1d/common.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- import torch DEPTH = 4 BATCH_SIZE = 8 SEQ_LENGTH = 8 IMG_SIZE = 16 HIDDEN_SIZE = 8 NUM_CLASSES = 8 VOCAB_SIZE = 16 def check_equal(A, B): assert torch.allclose(A, B, rtol=1e-3, atol=1e-1) == True
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_1d/checks_1d/__init__.py
tests/test_legacy/test_layers/test_1d/checks_1d/__init__.py
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_1d/checks_1d/check_layer_1d.py
tests/test_legacy/test_layers/test_1d/checks_1d/check_layer_1d.py
import torch import torch.distributed as dist from torch.nn import Parameter from colossalai.accelerator import get_accelerator from colossalai.legacy.context.parallel_mode import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.legacy.global_variables import tensor_parallel_env as...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_sequence/test_sequence.py
tests/test_legacy/test_layers/test_sequence/test_sequence.py
import pytest import torch import torch.distributed as dist import colossalai from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.legacy.nn.layer.parallel_sequence import RingAV, RingQK from colossalai.testing import rerun_if_address_is_in_use, sp...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_sequence/checks_seq/check_layer_seq.py
tests/test_legacy/test_layers/test_sequence/checks_seq/check_layer_seq.py
import torch from colossalai.accelerator import get_accelerator from colossalai.legacy.context import ParallelMode from colossalai.legacy.core import global_context as gpc from colossalai.legacy.nn import TransformerSelfAttentionRing def check_selfattention(): WORLD_SIZE = gpc.get_world_size(ParallelMode.SEQUENC...
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false
hpcaitech/ColossalAI
https://github.com/hpcaitech/ColossalAI/blob/b1915d2889543949eb5b610241f1515c73df5059/tests/test_legacy/test_layers/test_sequence/checks_seq/__init__.py
tests/test_legacy/test_layers/test_sequence/checks_seq/__init__.py
python
Apache-2.0
b1915d2889543949eb5b610241f1515c73df5059
2026-01-04T14:40:19.002665Z
false