MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / init_ernie_model

Function init_ernie_model

NLP/Text2SQL-BASELINE/text2sql/io.py:33–50  ·  view source on GitHub ↗

init ernie model from static graph checkpoint Args: model_class (TYPE): NULL model_dir (TYPE): NULL Returns: TODO Raises: NULL

(model_class, model_dir)

Source from the content-addressed store, hash-verified

31
32
33def init_ernie_model(model_class, model_dir):
34 """init ernie model from static graph checkpoint
35
36 Args:
37 model_class (TYPE): NULL
38 model_dir (TYPE): NULL
39
40 Returns: TODO
41
42 Raises: NULL
43 """
44 with open(os.path.join(model_dir, 'ernie_config.json')) as ifs:
45 config = json.load(ifs)
46
47 state = paddle.static.load_program_state(os.path.join(model_dir, 'params'))
48 ernie = model_class(config, name='')
49 ernie.set_dict(state, use_structured_name=False)
50 return ernie, config['hidden_size']
51
52
53def save(model, optimzer, save_path):

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected