def test_save_load_symbols_map(self): path = tempfile.mktemp() symbols_map = SymbolsMap({ "b": "a", "c": "b", "x": "y", }) symbols_map.save(path) res = SymbolsMap.load(path) os.remove(path) self.assertEqual(3, len(res)) self.assertEqual("a", res["b"]) self.assertEqual("b", res["c"]) self.assertEqual("y", res["x"])
def save_weights_map(prep_dir: str, orig_prep_name: str, weights_map: SymbolsMap): path = os.path.join(prep_dir, f"{orig_prep_name}.json") weights_map.save(path)
def save_infer_map(prep_dir: str, infer_map: SymbolsMap): infer_map.save(get_infer_map_path(prep_dir))