MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / import_object

Function import_object

lm-eval-harness/lm_eval/models/local_utils/jrt_utils.py:97–109  ·  view source on GitHub ↗

Import an object from a string. Parameters: - name (str): The name of the object to import. Returns: - object: The imported object.

(name: str)

Source from the content-addressed store, hash-verified

95
96
97def import_object(name: str):
98 """Import an object from a string.
99
100 Parameters:
101 - name (str): The name of the object to import.
102
103 Returns:
104 - object: The imported object.
105 """
106 import importlib
107 module_name, obj_name = name.rsplit('.', 1)
108 module = importlib.import_module(module_name)
109 return getattr(module, obj_name)
110
111
112def extended_json_dump(data: any, path: str=None):

Callers 1

load_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected