MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / __init__

Method __init__

rat-sql-gap/seq2struct/commands/infer.py:24–36  ·  view source on GitHub ↗
(self, config)

Source from the content-addressed store, hash-verified

22
23class Inferer:
24 def __init__(self, config):
25 self.config = config
26 if torch.cuda.is_available():
27 self.device = torch.device('cuda')
28 else:
29 self.device = torch.device('cpu')
30 torch.set_num_threads(1)
31
32 # 0. Construct preprocessors
33 self.model_preproc = registry.instantiate(
34 registry.lookup('model', config['model']).Preproc,
35 config['model'])
36 self.model_preproc.load()
37
38 def load_model(self, logdir, step):
39 '''Load a model (identified by the config used for construction) and return it'''

Callers

nothing calls this directly

Calls 3

deviceMethod · 0.80
lookupMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected