xax 0.2.10__py3-none-any.whl → 0.2.12__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.
xax/__init__.py CHANGED
@@ -12,7 +12,7 @@ and running the update script:
12
12
  python -m scripts.update_api --inplace
13
13
  """
14
14
 
15
- __version__ = "0.2.10"
15
+ __version__ = "0.2.12"
16
16
 
17
17
  # This list shouldn't be modified by hand; instead, run the update script.
18
18
  __all__ = [
@@ -32,7 +32,7 @@ class TensorboardLogger(LoggerImpl):
32
32
  flush_seconds: float = 10.0,
33
33
  wait_seconds: float = 0.0,
34
34
  start_in_subprocess: bool = True,
35
- use_localhost: bool = False,
35
+ use_localhost: bool | None = None,
36
36
  log_interval_seconds: float = 10.0,
37
37
  ) -> None:
38
38
  """Defines a logger which writes to Tensorboard.
@@ -49,6 +49,9 @@ class TensorboardLogger(LoggerImpl):
49
49
  """
50
50
  super().__init__(log_interval_seconds)
51
51
 
52
+ if use_localhost is None:
53
+ use_localhost = os.environ.get("USE_TENSORBOARD_LOCALHOST", "0") == "1"
54
+
52
55
  self.log_directory = Path(run_directory).expanduser().resolve() / subdirectory
53
56
  self.wait_seconds = wait_seconds
54
57
  self.start_in_subprocess = start_in_subprocess
xax/task/mixins/train.py CHANGED
@@ -120,8 +120,8 @@ class ValidStepTimer:
120
120
  self.last_valid_time = state.elapsed_time_s.item()
121
121
  self.last_valid_step = state.num_steps.item()
122
122
 
123
- def is_valid_step(self, state: State) -> bool:
124
- if state.num_steps < self.valid_first_n_steps:
123
+ def __call__(self, state: State) -> bool:
124
+ if state.num_steps < self.valid_first_n_steps and state.num_valid_steps < self.valid_first_n_steps:
125
125
  return True
126
126
 
127
127
  if self.last_valid_time is None or self.last_valid_step is None:
@@ -130,15 +130,18 @@ class ValidStepTimer:
130
130
 
131
131
  # Step-based validation.
132
132
  valid_every_n_steps = self.valid_every_n_steps
133
- if valid_every_n_steps is not None and state.num_steps >= valid_every_n_steps + self.last_valid_step:
133
+ if valid_every_n_steps is not None and (
134
+ state.num_steps >= valid_every_n_steps + self.last_valid_step
135
+ or state.num_valid_steps >= valid_every_n_steps + self.last_valid_step
136
+ ):
134
137
  self._reset(state)
135
138
  return True
136
139
 
137
140
  # Time-based validation.
138
141
  valid_every_n_seconds = self.valid_every_n_seconds
139
- if (
140
- valid_every_n_seconds is not None
141
- and state.elapsed_time_s.item() - self.last_valid_time >= valid_every_n_seconds
142
+ if valid_every_n_seconds is not None and (
143
+ state.elapsed_time_s.item() - self.last_valid_time >= valid_every_n_seconds
144
+ or state.valid_elapsed_time_s.item() - self.last_valid_time >= valid_every_n_seconds
142
145
  ):
143
146
  self._reset(state)
144
147
  return True
@@ -146,7 +149,10 @@ class ValidStepTimer:
146
149
  # Time-based validation for first validation step.
147
150
  if self.first_valid_step_flag:
148
151
  valid_first_n_seconds = self.valid_first_n_seconds
149
- if valid_first_n_seconds is not None and state.elapsed_time_s.item() >= valid_first_n_seconds:
152
+ if valid_first_n_seconds is not None and (
153
+ state.elapsed_time_s.item() >= valid_first_n_seconds
154
+ or state.valid_elapsed_time_s.item() >= valid_first_n_seconds
155
+ ):
150
156
  self._reset(state)
151
157
  self.first_valid_step_flag = False
152
158
  return True
@@ -272,7 +278,7 @@ class TrainMixin(
272
278
  v, secondary = v
273
279
  else:
274
280
  secondary = False
275
- self.logger.log_scalar(k, v, namespace=" timers", secondary=secondary)
281
+ self.logger.log_scalar(k, v, namespace="🕒 timers", secondary=secondary)
276
282
 
277
283
  def log_step(
278
284
  self,
@@ -722,7 +728,7 @@ class TrainMixin(
722
728
  model_arr, model_static = eqx.partition(model, self.model_partition_fn)
723
729
 
724
730
  while not self.is_training_over(state):
725
- if self.valid_step_timer.is_valid_step(state):
731
+ if self.valid_step_timer(state):
726
732
  with ContextTimer() as timer:
727
733
  valid_batch = next(valid_pf)
728
734
  output, metrics = self.val_step(model_arr, model_static, valid_batch, state)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xax
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Summary: A library for fast Jax experimentation
5
5
  Home-page: https://github.com/kscalelabs/xax
6
6
  Author: Benjamin Bolte
@@ -1,4 +1,4 @@
1
- xax/__init__.py,sha256=8gVPgaF2I-ObP5RU58OEvxPtHOD5a1i382CZbuW9jvM,15510
1
+ xax/__init__.py,sha256=GprJJQKvQtJp16V1-8GYWLgUtwueKLRsOrtWKUZRq9o,15510
2
2
  xax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  xax/requirements-dev.txt,sha256=qkscNkFzWd1S5fump-AKH53rR65v2x5FmboFdy_kKvs,128
4
4
  xax/requirements.txt,sha256=6qY-84e-sTmlfJNrSjwONQKqzAn5h8G_oGIhnhmfSr4,302
@@ -29,7 +29,7 @@ xax/task/loggers/callback.py,sha256=zQuV1xCvz47Q3UQqP1D5mBhbVzptvmPR_7hX25vqSk0,
29
29
  xax/task/loggers/json.py,sha256=6A5wL7kspsXnpPhI_vu0scgd2Z2-WLhw4gbBFm7eZMM,4377
30
30
  xax/task/loggers/state.py,sha256=0Jy0NYnY4c0qt0LvNlaTaCKOSqk5SCKln5VdyuQGnIc,1407
31
31
  xax/task/loggers/stdout.py,sha256=giKSW2R83YkgRefm3BLkE7t8Pbj5Dux4AgsdJxYIbGo,6619
32
- xax/task/loggers/tensorboard.py,sha256=gkAalLsYPGjZiiMlqvDWIhNpYCfKWNvnPz3brIv3JaQ,8725
32
+ xax/task/loggers/tensorboard.py,sha256=sdsA8GjZG5JQpoAxNDRr_bGvqN8Olgj_almZBb2K5F8,8850
33
33
  xax/task/mixins/__init__.py,sha256=D3oU31rB9FeOr9MPLleLt5JFbftUr4sBTwgnwQdc2qA,809
34
34
  xax/task/mixins/artifacts.py,sha256=Ma7fwsp-SA1w6GcuBSskszj5TB83yxYJm4Ns_EnqkI4,3018
35
35
  xax/task/mixins/checkpointing.py,sha256=zqospBFnTbGt_iriiduVfXazINPbzWpwmIs91KAniMY,10147
@@ -41,7 +41,7 @@ xax/task/mixins/logger.py,sha256=6oXsJJyNUx6YT3q58FVXMZBUpMgjVkGre6BXFN20cVI,280
41
41
  xax/task/mixins/process.py,sha256=hqDEsMp_SL6ee97iq26-G0g49OcWZZaX82JD4F22eJU,1781
42
42
  xax/task/mixins/runnable.py,sha256=IYIsLd2k09g-_y6o44EhJqT7E6BpsyEMmsyLSuzqjtc,1979
43
43
  xax/task/mixins/step_wrapper.py,sha256=-Yu5Nft2CRw1JvZt6J_94SM1vqX8fk08IDK95Pmd2ew,1648
44
- xax/task/mixins/train.py,sha256=ln-Qvx27gruRCyaVLHvTL1XzCDoEJ53Ep9Gp3JwsT9s,31268
44
+ xax/task/mixins/train.py,sha256=F5hNHGXCFQ2QbUqdZqhWcpDzR1JVoBOo3oCm0tcpAlA,31605
45
45
  xax/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  xax/utils/debugging.py,sha256=OtUdu-3tQsQtik0Q9UM-SNV46IbPjwrAfZcywzoB5d4,1940
47
47
  xax/utils/experiments.py,sha256=bj8BftSHT3fFzfiJ0Co0WvqWo0rUS8kQnQYpVvH8FTM,29942
@@ -58,8 +58,8 @@ xax/utils/data/collate.py,sha256=Rd9vMomr_S_zCa_Hi4dO-8ntzAfVwndIUtuXFA3iNcc,706
58
58
  xax/utils/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  xax/utils/types/frozen_dict.py,sha256=ebtHENhyUzSjyJTlbMaLtcckQIJ7EtgJiok_40TJZpo,4689
60
60
  xax/utils/types/hashable_array.py,sha256=l5iIcFmkYzfGeaZmcSoeFkthFASqM8xJYK3AXhZQYwc,992
61
- xax-0.2.10.dist-info/licenses/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
62
- xax-0.2.10.dist-info/METADATA,sha256=PwQsQ3uDewGQvQ5XQ6NT4SgZ15woG6YZgMw1ejLRT4g,1880
63
- xax-0.2.10.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
64
- xax-0.2.10.dist-info/top_level.txt,sha256=g4Au_r2XhvZ-lTybviH-Fh9g0zF4DAYHYxPue1-xbs8,4
65
- xax-0.2.10.dist-info/RECORD,,
61
+ xax-0.2.12.dist-info/licenses/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
62
+ xax-0.2.12.dist-info/METADATA,sha256=VJjr__ccXjzqrpvDzevgRlDW22GwLQGqAfTsHmbEk7I,1880
63
+ xax-0.2.12.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
64
+ xax-0.2.12.dist-info/top_level.txt,sha256=g4Au_r2XhvZ-lTybviH-Fh9g0zF4DAYHYxPue1-xbs8,4
65
+ xax-0.2.12.dist-info/RECORD,,
File without changes