MCPcopy Index your code
hub / github.com/InternLM/InternLM / load_config

Method load_config

internlm/core/context/parallel_context.py:154–169  ·  view source on GitHub ↗

Loads the configuration from either a dict or a file. Args: config (dict or str): Either a dict containing the configuration information or the filename of a file containing the configuration information. Raises: TypeError: Raises a TypeError

(self, config: Union[dict, str])

Source from the content-addressed store, hash-verified

152 return self._config
153
154 def load_config(self, config: Union[dict, str]):
155 """Loads the configuration from either a dict or a file.
156
157 Args:
158 config (dict or str): Either a dict containing the configuration information or the filename
159 of a file containing the configuration information.
160
161 Raises:
162 TypeError: Raises a TypeError if `config` is neither a dict nor a str.
163 """
164 if isinstance(config, str):
165 self._config = Config.from_file(config)
166 elif isinstance(config, dict):
167 self._config = Config(config)
168 else:
169 raise TypeError("Invalid type for config, only dictionary or string is supported")
170
171 def detect_num_processes_on_current_node(self):
172 hostname = socket.gethostname()

Callers 1

launchFunction · 0.80

Calls 2

ConfigClass · 0.85
from_fileMethod · 0.80

Tested by

no test coverage detected