returnn 1.20250211.110723__py3-none-any.whl → 1.20250211.215623__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of returnn might be problematic. Click here for more details.
- returnn/PKG-INFO +1 -1
- returnn/_setup_info_generated.py +2 -2
- returnn/datasets/lm.py +11 -2
- returnn/frontend/_cache.py +3 -0
- returnn/torch/engine.py +12 -0
- returnn/torch/frontend/bridge.py +21 -12
- returnn/util/lru_cache.py +2 -1
- {returnn-1.20250211.110723.dist-info → returnn-1.20250211.215623.dist-info}/METADATA +1 -1
- {returnn-1.20250211.110723.dist-info → returnn-1.20250211.215623.dist-info}/RECORD +12 -12
- {returnn-1.20250211.110723.dist-info → returnn-1.20250211.215623.dist-info}/LICENSE +0 -0
- {returnn-1.20250211.110723.dist-info → returnn-1.20250211.215623.dist-info}/WHEEL +0 -0
- {returnn-1.20250211.110723.dist-info → returnn-1.20250211.215623.dist-info}/top_level.txt +0 -0
returnn/PKG-INFO
CHANGED
returnn/_setup_info_generated.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version = '1.20250211.
|
|
2
|
-
long_version = '1.20250211.
|
|
1
|
+
version = '1.20250211.215623'
|
|
2
|
+
long_version = '1.20250211.215623+git.8640885'
|
returnn/datasets/lm.py
CHANGED
|
@@ -1087,8 +1087,17 @@ class Lexicon:
|
|
|
1087
1087
|
{"phon": e.text.strip(), "score": float(e.attrib.get("score", 0))}
|
|
1088
1088
|
for e in elem.findall("phon")
|
|
1089
1089
|
]
|
|
1090
|
-
|
|
1091
|
-
self.lemmas
|
|
1090
|
+
lemma = {"orth": orth, "phons": phons}
|
|
1091
|
+
if orth in self.lemmas: # unexpected, already exists?
|
|
1092
|
+
if self.lemmas[orth] == lemma:
|
|
1093
|
+
print(f"Warning: lemma {lemma} duplicated in lexicon {filename}", file=log.v4)
|
|
1094
|
+
else:
|
|
1095
|
+
raise Exception(
|
|
1096
|
+
f"orth {orth!r} lemma duplicated in lexicon {filename}."
|
|
1097
|
+
f" old: {self.lemmas[orth]}, new: {lemma}"
|
|
1098
|
+
)
|
|
1099
|
+
else: # lemma does not exist yet -- this is the expected case
|
|
1100
|
+
self.lemmas[orth] = lemma
|
|
1092
1101
|
root.clear() # free memory
|
|
1093
1102
|
print("Finished whole lexicon, %i lemmas" % len(self.lemmas), file=log.v4)
|
|
1094
1103
|
|
returnn/frontend/_cache.py
CHANGED
|
@@ -39,6 +39,9 @@ class Cache:
|
|
|
39
39
|
# not shared over all instances of this class.
|
|
40
40
|
self._lru_cache = lru_cache(max_size)(_lru_cache_dummy_func)
|
|
41
41
|
|
|
42
|
+
def __repr__(self):
|
|
43
|
+
return f"<{self.__class__.__module__}.{self.__class__.__qualname__} {self._lru_cache.cache_info()}>"
|
|
44
|
+
|
|
42
45
|
def get(self, key, default=None):
|
|
43
46
|
"""
|
|
44
47
|
:param key:
|
returnn/torch/engine.py
CHANGED
|
@@ -980,6 +980,7 @@ class Engine(EngineBase):
|
|
|
980
980
|
missing_keys_preload, unexpected_keys_preload = self._pt_model.load_state_dict(
|
|
981
981
|
preload_model_state, strict=False
|
|
982
982
|
)
|
|
983
|
+
preload_model_state_keys = set(preload_model_state.keys())
|
|
983
984
|
loaded_state_keys.update(preload_model_state.keys())
|
|
984
985
|
missing_keys.difference_update(preload_model_state.keys())
|
|
985
986
|
del preload_model_state
|
|
@@ -987,6 +988,11 @@ class Engine(EngineBase):
|
|
|
987
988
|
|
|
988
989
|
if opts.get("prefix", ""):
|
|
989
990
|
prefix_keys = [key for key in self._pt_model.state_dict() if key.startswith(opts.get("prefix", ""))]
|
|
991
|
+
if not prefix_keys:
|
|
992
|
+
raise Exception(
|
|
993
|
+
"No keys with prefix %r found in model.\nModel params:\n%s"
|
|
994
|
+
% (opts.get("prefix", ""), ", ".join(name for name, _ in self._pt_model.named_parameters()))
|
|
995
|
+
)
|
|
990
996
|
else:
|
|
991
997
|
prefix_keys = model_state_keys_set
|
|
992
998
|
missing_keys_preload = (
|
|
@@ -995,6 +1001,12 @@ class Engine(EngineBase):
|
|
|
995
1001
|
unexpected_keys_preload = (
|
|
996
1002
|
set(prefix_keys).intersection(set(unexpected_keys_preload)).difference(loaded_state_keys)
|
|
997
1003
|
)
|
|
1004
|
+
if not preload_model_state_keys.intersection(prefix_keys):
|
|
1005
|
+
raise Exception(
|
|
1006
|
+
f"No keys with prefix {opts.get('prefix', '')!r} found in preload model state.\n"
|
|
1007
|
+
f"Preload model state keys: {preload_model_state_keys}\n"
|
|
1008
|
+
f"Model state keys: {model_state_keys_set}"
|
|
1009
|
+
)
|
|
998
1010
|
if missing_keys_preload and not opts.get("ignore_missing", False):
|
|
999
1011
|
missing_keys.update(missing_keys_preload)
|
|
1000
1012
|
if missing_keys_preload:
|
returnn/torch/frontend/bridge.py
CHANGED
|
@@ -109,18 +109,27 @@ class RFModuleAsPTModule(torch.nn.Module):
|
|
|
109
109
|
self._aux_params_as_buffers = aux_params_as_buffers
|
|
110
110
|
self._is_initializing = True
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
for name, value in vars(rf_module).items():
|
|
113
|
+
if isinstance(value, rf.Parameter):
|
|
114
|
+
pt_param = value.raw_tensor
|
|
115
|
+
assert isinstance(pt_param, torch.nn.Parameter)
|
|
116
|
+
if value.auxiliary and aux_params_as_buffers:
|
|
117
|
+
self.register_buffer(name, pt_param)
|
|
118
|
+
else:
|
|
119
|
+
self.register_parameter(name, pt_param)
|
|
120
|
+
|
|
121
|
+
elif isinstance(value, rf.Module):
|
|
122
|
+
pt_mod = rf_module_to_pt_module(value, aux_params_as_buffers=aux_params_as_buffers)
|
|
123
|
+
self.add_module(name, pt_mod)
|
|
124
|
+
|
|
125
|
+
elif isinstance(value, torch.nn.Parameter):
|
|
126
|
+
self.register_parameter(name, value)
|
|
127
|
+
|
|
128
|
+
elif isinstance(value, torch.Tensor): # make sure this check is after torch.nn.Parameter
|
|
129
|
+
self.register_buffer(name, value)
|
|
130
|
+
|
|
131
|
+
elif isinstance(value, torch.nn.Module):
|
|
132
|
+
self.add_module(name, value)
|
|
124
133
|
|
|
125
134
|
self._is_initializing = False
|
|
126
135
|
|
returnn/util/lru_cache.py
CHANGED
|
@@ -196,7 +196,7 @@ def _lru_cache_wrapper(user_function, maxsize: int, typed: bool):
|
|
|
196
196
|
"""
|
|
197
197
|
Removes the entry from the cache.
|
|
198
198
|
"""
|
|
199
|
-
nonlocal hits, misses
|
|
199
|
+
nonlocal hits, misses, full
|
|
200
200
|
key = make_key(args, kwargs, typed)
|
|
201
201
|
with lock:
|
|
202
202
|
link = cache_get(key)
|
|
@@ -208,6 +208,7 @@ def _lru_cache_wrapper(user_function, maxsize: int, typed: bool):
|
|
|
208
208
|
oldvalue = link[RESULT]
|
|
209
209
|
link.clear()
|
|
210
210
|
del cache[oldkey]
|
|
211
|
+
full = cache_len() >= maxsize
|
|
211
212
|
return oldvalue
|
|
212
213
|
if fallback is not_specified:
|
|
213
214
|
raise KeyError("key not found")
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
returnn/PKG-INFO,sha256=
|
|
1
|
+
returnn/PKG-INFO,sha256=1no-Aukog5H0Mvgs1485nTteX29Fjp-sH7_kGvbMHG4,5215
|
|
2
2
|
returnn/__init__.py,sha256=biBtRsM0WZ406vShaeH-9WFoqJ8XwTbn6g0EeFJ7l8E,1012
|
|
3
3
|
returnn/__main__.py,sha256=qBFbuB1yN3adgVM5pXt2-Yq9vorjRNchNPL8kDKx44M,31752
|
|
4
4
|
returnn/__old_mod_loader__.py,sha256=nvsNY-xELdS_IPNkv66Q9Rmvg4dbGW0-EBRDcCmctos,7654
|
|
5
5
|
returnn/__setup__.py,sha256=22kQn2fh11iPM0hLb2Fy5sLmoU1JGvmDxXRYuRgQkwU,4659
|
|
6
|
-
returnn/_setup_info_generated.py,sha256=
|
|
6
|
+
returnn/_setup_info_generated.py,sha256=xvdH59j45tyParGsCGfKR4RXzo9TQAImKpm20b4ylGk,77
|
|
7
7
|
returnn/config.py,sha256=3tmKhB6FnQZaNdtcYsiB61JnEY--iZ2qmJ4yq0b6tE0,29140
|
|
8
8
|
returnn/forward_iface.py,sha256=A_OJiaXsX4MlXQRzST86ylyxSUZbC402PQL1REcqHjM,911
|
|
9
9
|
returnn/learning_rate_control.py,sha256=ZvWryAn_tv9DhV8sh1LV3eE34Yltl3On3mYZAG4hR9s,34684
|
|
@@ -20,7 +20,7 @@ returnn/datasets/cached2.py,sha256=STojLL2Ivvd0xMfZRlYgzsHKlikYKL-caZCIDCgc_9g,1
|
|
|
20
20
|
returnn/datasets/distrib_files.py,sha256=kyqIQILDPAO2TXr39hjslmDxIAc3pkY1UOoj8nuiFXo,27534
|
|
21
21
|
returnn/datasets/generating.py,sha256=e2-SXcax7xQ4fkVW_Q5MgOLP6KlB7EQXJi_v64gVAWI,99805
|
|
22
22
|
returnn/datasets/hdf.py,sha256=shif0aQqWWNJ0b6YnycpPjIVNsxjLrA41Y66-_SluGI,66993
|
|
23
|
-
returnn/datasets/lm.py,sha256=
|
|
23
|
+
returnn/datasets/lm.py,sha256=h0IHUbze87njKrcD5eT1FRxde7elIio05n-BWiqmjFE,98805
|
|
24
24
|
returnn/datasets/map.py,sha256=kOBJVZmwDhLsOplzDNByIfa0NRSUaMo2Lsy36lBvxrM,10907
|
|
25
25
|
returnn/datasets/meta.py,sha256=wHquywF1C7-YWhcSFSAdDNc0nEHRjE-ks7YIEuDFMIE,94731
|
|
26
26
|
returnn/datasets/multi_proc.py,sha256=7kppiXGiel824HM3GvHegluIxtiNAHafm-e6qh6W7YU,21948
|
|
@@ -76,7 +76,7 @@ returnn/extern/graph_editor/transform.py,sha256=d9fEgu0JC342q0g9niVxRWMKzkQQA9mr
|
|
|
76
76
|
returnn/extern/graph_editor/util.py,sha256=QMrQeQZ7lJwsrNQub9tof0h3quEaoHiGJaZmogQ7jXE,18707
|
|
77
77
|
returnn/frontend/__init__.py,sha256=2aS7nbxXniIrBp2DODl0xN0f3IJ_dX4Bi9ZlR7W5_DE,1472
|
|
78
78
|
returnn/frontend/_backend.py,sha256=datTTGM6xhvpiSPphDZgRjruU-SxrowG15_ZnTkEKy0,50108
|
|
79
|
-
returnn/frontend/_cache.py,sha256=
|
|
79
|
+
returnn/frontend/_cache.py,sha256=JAhi7L-raQ3A-NC3JUYDtdRTwT3BGJJGGZxrZ8MfEWQ,8403
|
|
80
80
|
returnn/frontend/_numpy_backend.py,sha256=_akZZkZplzR8XNVIrenvR99s-CapWDYL9WSD7VXwGYI,7790
|
|
81
81
|
returnn/frontend/_random_journal.py,sha256=_ktP_mjgx8vtQQGX_DofdhewJj0aPiczefTWeemPkmo,5457
|
|
82
82
|
returnn/frontend/_utils.py,sha256=4A3MSRM0i86J77550uR_AjcBEPu6nymLUZ9Xd1V3Fkc,12073
|
|
@@ -207,7 +207,7 @@ returnn/tf/util/open_fst.py,sha256=sZRDw4TbxvhGqpGdUJWy1ebvlZm4_RPhygpRw9uLAOQ,1
|
|
|
207
207
|
returnn/torch/README.md,sha256=jzJ2FpOHW02vxN69yKaV97C9LI-hmvjBglKfdZXIDdc,85
|
|
208
208
|
returnn/torch/__init__.py,sha256=MHEUyNHB20Vy89uKAqZoj6FxJKF1Gq3HW-i6ra1pNcI,24
|
|
209
209
|
returnn/torch/distributed.py,sha256=i13cUVjI7GxpO0TAresrNyCM0ZBAaf-cXNr09Fmg_2k,6266
|
|
210
|
-
returnn/torch/engine.py,sha256=
|
|
210
|
+
returnn/torch/engine.py,sha256=8BIpdcrpbJL9HrvCX-hISh-14zW9aSrHGvRWT9s0zOk,77103
|
|
211
211
|
returnn/torch/updater.py,sha256=GqtBvZpElPVMm0lq84JPl4NVLFFETZAzAbR0rTomSao,28249
|
|
212
212
|
returnn/torch/data/__init__.py,sha256=6cLNEi8KoGI12PF6akN7mI_mtjlx-0hcQAfMYoExwik,132
|
|
213
213
|
returnn/torch/data/extern_data.py,sha256=_uT_9_gd5HIh1IoRsrebVG-nufSnb7fgC5jyU05GxJg,7580
|
|
@@ -218,7 +218,7 @@ returnn/torch/data/tensor_utils.py,sha256=-Teqi--LLbt6q_5mDRdoHZHmPgSdC83W706uki
|
|
|
218
218
|
returnn/torch/frontend/__init__.py,sha256=AA48HZnC17ASuKA0EWy8loZ-Bib_yUtqF4T1wYvjst4,62
|
|
219
219
|
returnn/torch/frontend/_backend.py,sha256=h_rUhBPxLRgpZSqX4C8vX8q4dHWMhZpwPmGbKN6MsZo,99995
|
|
220
220
|
returnn/torch/frontend/_rand.py,sha256=1JgIkV2XmpgJD86zXZ-NCAe-QuoP2swr6NaS1oz3Qa8,1830
|
|
221
|
-
returnn/torch/frontend/bridge.py,sha256=
|
|
221
|
+
returnn/torch/frontend/bridge.py,sha256=Z2_UW8AagezC7zsXDc5PKcd8G9WwisV7j9SWGHU0m4U,7840
|
|
222
222
|
returnn/torch/frontend/raw_ops.py,sha256=lF0h-KtYYsdaaqQADylVZp9qzPskOOXA4MfmYDyx5IU,296
|
|
223
223
|
returnn/torch/optim/README.md,sha256=0iH5FiKb7iDrVK5n8V6yCh4ciCFG2YSbyh7lPneT5ik,360
|
|
224
224
|
returnn/torch/optim/__init__.py,sha256=yxdbnOkXAHzZ_t6cHi6zn5x_DQNlLZJ-KxZByHTIg1U,29
|
|
@@ -241,7 +241,7 @@ returnn/util/debug_helpers.py,sha256=0EINLK4uLtoSt5_kHs1M2NIFpMd0S7i4c4rx90U4fJk
|
|
|
241
241
|
returnn/util/file_cache.py,sha256=JvJ4C7NFr8WpiIN0hLk3c33oX4-JfWSpchTjY7JGpCc,23127
|
|
242
242
|
returnn/util/fsa.py,sha256=k2lJ8tyf_g44Xk1EPVLwDwpP4spoMTqIigDVOWocQHY,59177
|
|
243
243
|
returnn/util/literal_py_to_pickle.py,sha256=3dnjWPeeiDT2xp4bRDgIf9yddx7b1AG7mOKEn_jiSl8,2173
|
|
244
|
-
returnn/util/lru_cache.py,sha256=
|
|
244
|
+
returnn/util/lru_cache.py,sha256=Kd6j_SitMERTfXvNKGdtzErKXkZ4jCJNETtaCv4HzKM,11443
|
|
245
245
|
returnn/util/math.py,sha256=ximPqNsv0Wu6VNcCLqNfsmSu1s-VPsAJYt5nEvFZVtY,6691
|
|
246
246
|
returnn/util/multi_proc_non_daemonic_spawn.py,sha256=YCW3Gry0RJ9Dsc5bKfZ77Q06eLjq6winGniYllJE7PU,9057
|
|
247
247
|
returnn/util/native_code_compiler.py,sha256=T6eZwzNA7AnkpNpo61AbYVNVtKqdWBbQfvJEQVe-cHE,13172
|
|
@@ -253,8 +253,8 @@ returnn/util/sig_proc.py,sha256=Tjz0VOAVyqu2qDCF5HZ1JjALjcFsHcNkcd96WgZeKfE,7265
|
|
|
253
253
|
returnn/util/task_system.py,sha256=y4sMVXQ25Qd2z0rx03uOlXlkE-jbCYC1Sjfn-XlraVU,26003
|
|
254
254
|
returnn/util/train_proc_manager.py,sha256=Pjht28k6uz6BNQ47uW6Gf880iyq5q4wx7P_K2tmoAM8,3266
|
|
255
255
|
returnn/util/watch_memory.py,sha256=BR5P2kvBN6UI81cE0_1WAA6Hd1SByLbBaiDxvLhPOew,4213
|
|
256
|
-
returnn-1.20250211.
|
|
257
|
-
returnn-1.20250211.
|
|
258
|
-
returnn-1.20250211.
|
|
259
|
-
returnn-1.20250211.
|
|
260
|
-
returnn-1.20250211.
|
|
256
|
+
returnn-1.20250211.215623.dist-info/LICENSE,sha256=ywBD_U2aD4vpuoIgNAsjIGBYydl0tVKll3De0Z8s77c,11041
|
|
257
|
+
returnn-1.20250211.215623.dist-info/METADATA,sha256=1no-Aukog5H0Mvgs1485nTteX29Fjp-sH7_kGvbMHG4,5215
|
|
258
|
+
returnn-1.20250211.215623.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
259
|
+
returnn-1.20250211.215623.dist-info/top_level.txt,sha256=Lsn4WZc5Pbfk0-xDQOgnFCxOoqxL4CyeM3N1TFbJncw,8
|
|
260
|
+
returnn-1.20250211.215623.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|