mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-24 19:17:30 +00:00
html refactor (#555)
This commit is contained in:
@@ -29,21 +29,22 @@ def build_from_registry(config, registry: Registry):
|
||||
is specified by `registry`.
|
||||
|
||||
Note:
|
||||
the `config` is used to construct the return object such as `LAYERS`,
|
||||
`OPTIMIZERS` and other support types in `registry`. The `config` should contain
|
||||
all required parameters of corresponding object. The details of support
|
||||
types in `registry` and the `mod_type` in `config` could be found in
|
||||
`registry <https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/registry/__init__.py>`_.
|
||||
the `config` is used to construct the return object such as `LAYERS`, `OPTIMIZERS`
|
||||
and other support types in `registry`. The `config` should contain
|
||||
all required parameters of corresponding object. The details of support
|
||||
types in `registry` and the `mod_type` in `config` could be found in
|
||||
`registry <https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/registry/__init__.py>`_.
|
||||
|
||||
Args:
|
||||
config (dict or :class:`colossalai.context.colossalai.context.Config`): information
|
||||
used in the construction of the return object.
|
||||
registry (:class:`Registry`): A registry specifying the type of the return object
|
||||
|
||||
Returns: A Python object specified by `registry`
|
||||
Returns:
|
||||
A Python object specified by `registry`.
|
||||
|
||||
Raises:
|
||||
Exception: Raises an Exception if an error occurred when building from registry
|
||||
Exception: Raises an Exception if an error occurred when building from registry.
|
||||
"""
|
||||
config_ = config.copy() # keep the original config untouched
|
||||
assert isinstance(
|
||||
|
@@ -163,17 +163,19 @@ def count_layer_params(layers):
|
||||
|
||||
|
||||
def build_pipeline_model_from_cfg(config, num_chunks: int = 1, partition_method: str = 'parameter', verbose: bool = False):
|
||||
"""An intializer to split the model into different stages for pipeline parallelism.
|
||||
"""An initializer to split the model into different stages for pipeline parallelism.
|
||||
|
||||
An example for the model config is shown below. The class VisionTransformerFromConfig should
|
||||
inherit colossalai.nn.model.ModelFromConfig to allow this initializer to build model from a sequence
|
||||
of layer configurations.
|
||||
|
||||
model_config = dict(
|
||||
type='VisionTransformerFromConfig',
|
||||
embedding_cfg=dict(...),
|
||||
...
|
||||
)
|
||||
::
|
||||
|
||||
model_config = dict(
|
||||
type='VisionTransformerFromConfig',
|
||||
embedding_cfg=dict(...),
|
||||
...
|
||||
)
|
||||
|
||||
Args:
|
||||
config (dict): Configuration of the model.
|
||||
|
Reference in New Issue
Block a user