mindformers.core.build_context

View Source On Gitee
mindformers.core.build_context(config: Union[dict, MindFormerConfig, TrainingArguments])[source]

Build the context from config.

Note

parameter config must contain keys: 'context', 'parallel', when config is dict.

Parameters

config (Union[dict, MindFormerConfig, TrainingArguments]) – The configuration to initialize the context. This can be a dictionary, a MindFormerConfig instance, or a TrainingArguments instance.

Returns

_Context, The instantiated context.

Examples

>>> from mindformers import build_context
>>> config = {'context': {'mode': 'GRAPH_MODE'}, 'parallel':{}}
>>> build_context(config=config)