learning-loop-node 0.23.0__py3-none-any.whl → 0.24.0__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.
@@ -37,7 +37,7 @@ class Outbox():
37
37
  It handles upload failures by splitting the upload into two smaller batches until the problematic image is identified - and removed.
38
38
  Any image can be saved to the normal or the priority queue.
39
39
  Images in the priority queue are uploaded first.
40
- The total queue length is limited to 1000 images.
40
+ The normal queue is limited to MAX_OUTBOX_SIZE images (default 1000); the oldest are dropped first.
41
41
  """
42
42
 
43
43
  def __init__(self) -> None:
@@ -59,7 +59,9 @@ class Outbox():
59
59
  self.log.info('Outbox initialized with target_uri: %s', self.target_uri)
60
60
 
61
61
  self.BATCH_SIZE = 20
62
- self.MAX_UPLOAD_LENGTH = 1000 # only affects the `upload_folders` list
62
+ self.MAX_UPLOAD_LENGTH = int(os.environ.get('MAX_OUTBOX_SIZE', '1000')) # only limits `upload_folders`
63
+ if self.MAX_UPLOAD_LENGTH <= 0:
64
+ raise ValueError(f'MAX_OUTBOX_SIZE must be positive, got {self.MAX_UPLOAD_LENGTH}')
63
65
  self.UPLOAD_INTERVAL_S = 5
64
66
  self.UPLOAD_TIMEOUT_S = 30
65
67
 
@@ -12,21 +12,27 @@ from argparse import Action, Namespace
12
12
  import configargparse
13
13
  import uvicorn
14
14
 
15
+ from ..trainer.batch_size import VRAM_LIMIT_GB_FLAG, VRAM_LIMIT_GB_HELP
16
+
15
17
  logger = logging.getLogger(__name__)
16
18
 
17
19
 
18
- def node_parser(*, description: str, legacy_env_prefix: str = '') -> configargparse.ArgumentParser:
20
+ def node_parser(*, description: str, legacy_env_prefix: str = '',
21
+ vram_limit: bool = False) -> configargparse.ArgumentParser:
19
22
  """Build the parser for a node, pre-loaded with the settings every node has.
20
23
 
21
24
  :param legacy_env_prefix: A prefix an earlier version of this node required, e.g.
22
25
  ``'MY_DETECTOR_'``. Both spellings keep working, with a warning: the prefix on the
23
26
  current name (``MY_DETECTOR_NODE_HOST``) and the prefix on the flag it was originally
24
27
  applied to (``MY_DETECTOR_HOST``). Leave empty for a node that never used one.
28
+ :param vram_limit: Add :data:`~learning_loop_node.trainer.batch_size.VRAM_LIMIT_GB_FLAG`.
25
29
  """
26
30
  parser = _NodeArgumentParser(description=description, legacy_env_prefix=legacy_env_prefix)
27
31
  parser.add_argument('--host', default='0.0.0.0', env_var='NODE_HOST',
28
32
  help='Host interface to bind to')
29
33
  parser.add_argument('--port', type=int, default=80, env_var='NODE_PORT', help='Port to bind to')
34
+ if vram_limit:
35
+ parser.add_argument(VRAM_LIMIT_GB_FLAG, type=float, default=0, help=VRAM_LIMIT_GB_HELP)
30
36
  return parser
31
37
 
32
38
 
@@ -10,12 +10,29 @@ https://github.com/Lightning-AI/pytorch-lightning
10
10
  """
11
11
 
12
12
  import logging
13
- from collections.abc import Callable
13
+ from collections.abc import Callable, Mapping
14
+ from typing import Any
14
15
 
15
16
  from .exceptions import InsufficientMemoryError
16
17
 
17
18
  logger = logging.getLogger(__name__)
18
19
 
20
+ REQUESTED_BATCH_SIZE = 'max_batch_size'
21
+ """The hyperparameter every node reads its `measure_batch_size` argument out of.
22
+
23
+ 0 or absent means the card decides. It is an input only: a trainer reports the size it settled on
24
+ under a different key, conventionally ``batch_size``, and never writes it back here.
25
+ """
26
+
27
+ VRAM_LIMIT_GB_FLAG = '--vram-limit-gb'
28
+ """The flag a trainer takes its GPU budget from; ``VRAM_LIMIT_GB`` follows from the name."""
29
+
30
+ VRAM_LIMIT_GB_HELP = ('Gigabytes of GPU memory a training may use. The batch size is probed against this limit '
31
+ 'instead of the whole card, so a lower limit yields a smaller batch size rather than an '
32
+ 'out-of-memory error. Use it to share a GPU or to keep headroom against fragmentation. '
33
+ "The limit is relative to the card's total memory, not to what is currently free. "
34
+ '0 (default) means no limit.')
35
+
19
36
  MAX_BATCH_SIZE = 1024
20
37
  """Where a search stops when its caller sets no bound of its own."""
21
38
 
@@ -26,23 +43,51 @@ MIN_TRAIN_STEPS_PER_EPOCH = 8
26
43
  """Fewest optimizer steps an epoch must have; :func:`dataset_limit` is derived from it."""
27
44
 
28
45
 
29
- def find_batch_size(fits: Callable[[int], bool], *, limit: int) -> int:
30
- """Return the largest power-of-two batch size that fits, never exceeding ``limit``.
46
+ def find_batch_size(fits: Callable[[int], bool], *, limit: int, minimum: int = 1,
47
+ candidate: int = 0) -> int:
48
+ """Return the largest batch size that fits, never exceeding ``limit``.
49
+
50
+ Powers of two, plus ``minimum`` and ``candidate``, the two sizes outside that set this will
51
+ return, and only because somebody named them and they then measured.
31
52
 
32
53
  :param fits: Runs a representative probe; ``False`` on out-of-memory.
33
- :raises InsufficientMemoryError: If not even a batch size of 1 fits.
54
+ :param limit: Upper bound; the doubling stops at the largest power of two within it.
55
+ :param minimum: Smallest size to try, as named; the doubling continues from the next power of
56
+ two above it. Raise it above one for a step that cannot run on a single sample at all:
57
+ BatchNorm over a 1x1 feature map, a validation pass that halves the batch.
58
+ :param candidate: An exact size, tried once the doubling has reached its ceiling, so a size
59
+ that was asked for is used as asked for rather than rounded down. Ignored unless it lies
60
+ between that ceiling and ``limit``; a bound nobody named — one derived from the dataset,
61
+ say — must not be passed here.
62
+ :raises InsufficientMemoryError: If not even ``minimum`` fits.
34
63
  """
35
- limit = smaller_pot(limit)
36
- if not fits(1):
37
- raise InsufficientMemoryError('batch size 1 does not fit in memory')
64
+ minimum = max(1, minimum)
65
+ bound = max(limit, minimum)
66
+ ceiling = max(smaller_pot(bound), minimum)
67
+
68
+ if not fits(minimum):
69
+ raise InsufficientMemoryError(f'batch size {minimum} does not fit in memory')
38
70
 
39
- size = 1
40
- while size < limit and fits(size * 2):
41
- size *= 2
71
+ size = minimum
72
+ while size < ceiling and fits(smaller_pot(size) * 2):
73
+ size = smaller_pot(size) * 2
74
+
75
+ if size == ceiling and ceiling < candidate <= bound and fits(candidate):
76
+ size = candidate
42
77
 
43
78
  return size
44
79
 
45
80
 
81
+ def requested_batch_size(hyperparameters: Mapping[str, Any]) -> int:
82
+ """The bound a training asked for, read out of the hyperparameters the loop sent.
83
+
84
+ An unfilled field arrives as absent, ``None`` or ``''``, and all three mean no bound.
85
+
86
+ :raises ValueError: If the value is there but is not a number.
87
+ """
88
+ return int(hyperparameters.get(REQUESTED_BATCH_SIZE, 0) or 0)
89
+
90
+
46
91
  def dataset_limit(sample_count: int) -> int:
47
92
  """The batch size ceiling that still leaves ``MIN_TRAIN_STEPS_PER_EPOCH`` steps per epoch."""
48
93
  if sample_count < 1:
@@ -50,9 +95,9 @@ def dataset_limit(sample_count: int) -> int:
50
95
  return max(1, sample_count // MIN_TRAIN_STEPS_PER_EPOCH)
51
96
 
52
97
 
53
- def no_gpu_batch_size(limit: int, probe: str) -> int:
54
- """The batch size to fall back on when there is no GPU to probe."""
55
- batch_size = min(smaller_pot(limit), NO_GPU_BATCH_SIZE)
98
+ def no_gpu_batch_size(limit: int, probe: str, minimum: int = 1) -> int:
99
+ """The batch size to fall back on when there is no GPU to probe; never below ``minimum``."""
100
+ batch_size = max(min(smaller_pot(limit), NO_GPU_BATCH_SIZE), minimum)
56
101
  logger.warning('%s: CUDA is unavailable; using batch size %d without probing', probe, batch_size)
57
102
  return batch_size
58
103
 
@@ -11,47 +11,185 @@ from __future__ import annotations
11
11
 
12
12
  import gc
13
13
  import logging
14
+ from abc import ABC, abstractmethod
15
+ from argparse import ArgumentParser
14
16
  from collections.abc import Callable
15
17
 
16
18
  import torch
17
19
 
18
- from .batch_size import MAX_BATCH_SIZE, find_batch_size, is_out_of_memory, no_gpu_batch_size, smaller_pot
20
+ from .batch_size import (
21
+ MAX_BATCH_SIZE,
22
+ REQUESTED_BATCH_SIZE,
23
+ VRAM_LIMIT_GB_FLAG,
24
+ VRAM_LIMIT_GB_HELP,
25
+ dataset_limit,
26
+ find_batch_size,
27
+ is_out_of_memory,
28
+ no_gpu_batch_size,
29
+ )
19
30
 
20
31
  logger = logging.getLogger(__name__)
21
32
 
22
33
  SAFETY_MARGIN = 0.05
23
34
  """Share of the budget held back while probing, against allocator fragmentation later on."""
24
35
 
36
+ DEFAULT_STEPS_PER_TRIAL = 4
37
+ """Training steps a batch size must survive before it counts as fitting.
38
+
39
+ Some trainings reach their peak only after a few steps: an optimizer that allocates its state on
40
+ the first one, gradients that accumulate, a scaler that skips the first updates.
41
+ """
42
+
43
+ _budget_gb: float = 0
44
+ """What :func:`limit_cuda_memory` capped this process to; 0 means the whole card."""
45
+
46
+
47
+ class ProbeStep(ABC):
48
+ """A training cycle built for one batch-size probe and released once the probe is done.
49
+
50
+ :func:`measure_batch_size` builds it through a factory, after the safety margin is reserved,
51
+ and holds the only reference to it, so nothing built for the probe stays on the card for the
52
+ training that follows. A trial at one batch size is ``steps_per_trial`` calls of
53
+ :meth:`train_step` followed by one of :meth:`val_step`; a subclass implements both, the other
54
+ two are optional.
55
+ """
56
+
57
+ @abstractmethod
58
+ def train_step(self, batch_size: int) -> str | None:
59
+ """Run one training step at ``batch_size``; may return a detail to append to the log line."""
60
+
61
+ @abstractmethod
62
+ def val_step(self, batch_size: int) -> str | None:
63
+ """Run the validation a training at ``batch_size`` runs between epochs.
64
+
65
+ Validate at the batch size the training validates with, which need not be ``batch_size``
66
+ (YOLOv5 halves it). A training that does not validate returns ``None`` without running
67
+ anything.
68
+ """
69
+
70
+ def on_out_of_memory(self) -> None: # noqa: B027
71
+ """Drop what a trial that ran out of memory left behind (an optimizer's gradients, say)."""
72
+
73
+ def release(self) -> None: # noqa: B027
74
+ """Undo what building the step changed outside it, such as moving the real model off the card."""
75
+
76
+
77
+ def measure_batch_size(build_step: Callable[[], ProbeStep], *, max_batch_size: int = 0,
78
+ sample_count: int | None = None, probe: str = 'batch-size probe',
79
+ minimum: int = 1, steps_per_trial: int = DEFAULT_STEPS_PER_TRIAL) -> int:
80
+ """Settle a training's batch size against what it asked for and what the card allows.
81
+
82
+ Every training enters here, whatever shape its hyperparameters have; :func:`probe_batch_size` is
83
+ for a probe with no requested size to honour, such as a detection pass bounded only by how many
84
+ images there are. The step is built only once there is a card to probe.
85
+
86
+ :param build_step: Builds the step the trials run; called once, after the margin is reserved.
87
+ :param max_batch_size: What the training asked for, as carried in the
88
+ :data:`~.batch_size.REQUESTED_BATCH_SIZE` hyperparameter: the largest batch it may use,
89
+ measured rather than trusted. A size that fits is used as asked for, whether or not it is a
90
+ power of two; one that does not becomes the largest power of two below it that does. 0 means
91
+ the card decides alone. A request below ``minimum`` is raised to it, with a warning.
92
+ :param sample_count: Samples in the training split, when the caller knows it. The search is
93
+ then bounded by :func:`~.batch_size.dataset_limit`; that bound is never used as the exact
94
+ candidate.
95
+ :param probe: Names this probe in the log, so a node running several stays readable.
96
+ :param minimum: Smallest size to try, taking precedence over ``max_batch_size``; see
97
+ :func:`~.batch_size.find_batch_size`.
98
+ :param steps_per_trial: Training steps a size must survive, each trial then ending in one
99
+ validation step.
100
+ :raises InsufficientMemoryError: If not even ``minimum`` fits.
101
+ :raises ValueError: If the training asked for a negative batch size, or ``steps_per_trial`` is
102
+ below one.
103
+ """
104
+ if max_batch_size < 0:
105
+ raise ValueError(f'{REQUESTED_BATCH_SIZE} must be >= 0, got {max_batch_size}')
106
+ if steps_per_trial < 1:
107
+ raise ValueError(f'steps_per_trial must be >= 1, got {steps_per_trial}')
108
+ if 0 < max_batch_size < minimum:
109
+ logger.warning('%s: requested %s=%d is below the trainer minimum of %d; using %d', probe,
110
+ REQUESTED_BATCH_SIZE, max_batch_size, minimum, minimum)
111
+
112
+ limit = max_batch_size
113
+ if sample_count is not None:
114
+ limit = min(limit or MAX_BATCH_SIZE, dataset_limit(sample_count))
115
+ logger.info('%s: %d training samples allow at most %d per batch', probe, sample_count,
116
+ dataset_limit(sample_count))
117
+
118
+ return _probe(build_step, probe=probe, limit=limit, steps_per_trial=steps_per_trial,
119
+ candidate=max_batch_size, minimum=minimum)
25
120
 
26
- def probe_batch_size(run_batch: Callable[[int], str | None], *, probe: str = 'batch-size probe',
27
- limit: int = 0, vram_limit_gb: float = 0) -> int:
28
- """Find the largest power-of-two batch size ``run_batch`` fits into.
29
121
 
30
- For a probe whose measurement is one call. A probe that has to build a throwaway model first
31
- composes :func:`reserve_margin`, :func:`measured_fits` and ``find_batch_size`` itself.
122
+ def probe_batch_size(run_batch: Callable[[int], str | None], *, probe: str = 'batch-size probe',
123
+ limit: int = 0) -> int:
124
+ """Find the largest batch that fits for a pass with no requested size, such as a detection pass.
32
125
 
33
126
  :param run_batch: Runs the batch; may return a detail to append to the log line.
34
127
  :param probe: Names this probe in the log, so a node running several stays readable.
35
- :param limit: Caps the search, rounded down to a power of two; 0 means
128
+ :param limit: Caps the search; 0 means
36
129
  :data:`~learning_loop_node.trainer.batch_size.MAX_BATCH_SIZE`.
37
- :param vram_limit_gb: The budget the safety margin is a share of; 0 means the whole card.
38
- :raises InsufficientMemoryError: If not even a batch size of 1 fits.
130
+ :raises InsufficientMemoryError: If not even a batch of one fits.
39
131
  """
40
- limit = smaller_pot(limit or MAX_BATCH_SIZE)
132
+ return _probe(lambda: _PassStep(run_batch), probe=probe, limit=limit, steps_per_trial=1)
133
+
134
+
135
+ class _PassStep(ProbeStep):
136
+ """A plain callable as a step; there is nothing of its own to build, validate or release."""
137
+
138
+ def __init__(self, run_batch: Callable[[int], str | None]) -> None:
139
+ self._run_batch = run_batch
140
+
141
+ def train_step(self, batch_size: int) -> str | None:
142
+ return self._run_batch(batch_size)
143
+
144
+ def val_step(self, batch_size: int) -> None:
145
+ return None
146
+
147
+
148
+ def _probe(build_step: Callable[[], ProbeStep], *, probe: str, limit: int, steps_per_trial: int,
149
+ candidate: int = 0, minimum: int = 1) -> int:
150
+ """Everything of a probe but the step: the GPU check, the margin, the search, the release.
151
+
152
+ The margin is a share of the budget :func:`limit_cuda_memory` set in this process.
153
+ """
154
+ bound = max(limit or MAX_BATCH_SIZE, minimum)
41
155
 
42
156
  if not torch.cuda.is_available():
43
- return no_gpu_batch_size(limit, probe)
157
+ return no_gpu_batch_size(bound, probe, minimum)
44
158
 
45
- margin = reserve_margin(vram_limit_gb, probe=probe)
159
+ margin = reserve_margin(probe=probe)
46
160
  try:
47
- chosen = find_batch_size(measured_fits(run_batch, probe=probe), limit=limit)
161
+ chosen = _search(build_step, probe=probe, bound=bound, steps_per_trial=steps_per_trial,
162
+ minimum=minimum, candidate=candidate)
48
163
  finally:
49
164
  del margin
50
165
  free_cuda_memory()
51
- logger.info('%s: selected batch size %d (upper bound %d)', probe, chosen, limit)
166
+ logger.info('%s: selected batch size %d (upper bound %d)', probe, chosen, bound)
52
167
  return chosen
53
168
 
54
169
 
170
+ def _search(build_step: Callable[[], ProbeStep], *, probe: str, bound: int, steps_per_trial: int,
171
+ minimum: int, candidate: int) -> int:
172
+ """Build the step, search with it and release it; once this returns, nothing references it."""
173
+ step = build_step()
174
+ try:
175
+ fits = measured_fits(_trial(step, steps_per_trial), probe=probe, on_out_of_memory=step.on_out_of_memory)
176
+ return find_batch_size(fits, limit=bound, minimum=minimum, candidate=candidate)
177
+ finally:
178
+ step.release()
179
+
180
+
181
+ def _trial(step: ProbeStep, steps_per_trial: int) -> Callable[[int], str | None]:
182
+ """One trial of ``step``: its training steps, then its validation."""
183
+ def run_trial(batch_size: int) -> str | None:
184
+ train_detail = None
185
+ for _ in range(steps_per_trial):
186
+ train_detail = step.train_step(batch_size)
187
+ val_detail = step.val_step(batch_size)
188
+ return '; '.join(detail for detail in (train_detail, val_detail) if detail) or None
189
+
190
+ return run_trial
191
+
192
+
55
193
  def measured_fits(run_batch: Callable[[int], str | None], *, probe: str,
56
194
  on_out_of_memory: Callable[[], None] | None = None) -> Callable[[int], bool]:
57
195
  """Wrap ``run_batch`` into the ``fits`` predicate ``find_batch_size`` searches with.
@@ -84,38 +222,41 @@ def measured_fits(run_batch: Callable[[int], str | None], *, probe: str,
84
222
  return fits
85
223
 
86
224
 
87
- def reserve_margin(vram_limit_gb: float, *, probe: str) -> torch.Tensor:
225
+ def reserve_margin(*, probe: str) -> torch.Tensor:
88
226
  """Claim :data:`SAFETY_MARGIN` of the budget, so a trial competes against a smaller card.
89
227
 
90
228
  Keep the returned tensor alive for as long as the probe runs: releasing it hands the margin
91
229
  back, and the chosen size is no longer the size that was measured.
92
-
93
- :param vram_limit_gb: The budget the margin is a share of; 0 means the whole card.
94
230
  """
95
- margin_bytes = int(usable_memory_bytes(vram_limit_gb) * SAFETY_MARGIN)
231
+ margin_bytes = int(usable_memory_bytes() * SAFETY_MARGIN)
96
232
  logger.info('%s: keeping %.0f MB free as a safety margin', probe, margin_bytes / 1024**2)
97
233
  return torch.empty(margin_bytes, dtype=torch.uint8, device='cuda')
98
234
 
99
235
 
100
- def usable_memory_bytes(vram_limit_gb: float) -> int:
101
- """How much GPU memory this process may allocate, honouring :func:`limit_cuda_memory`.
236
+ def usable_memory_bytes() -> int:
237
+ """How much GPU memory this process may allocate, honouring :func:`limit_cuda_memory`."""
238
+ if _budget_gb > 0:
239
+ return int(_budget_gb * 1024**3)
240
+ return torch.cuda.get_device_properties(None).total_memory
241
+
102
242
 
103
- :param vram_limit_gb: 0 or less means the whole card.
243
+ def add_vram_limit_argument(parser: ArgumentParser) -> None:
244
+ """Give a spawned training script the same GPU budget flag its node has.
245
+
246
+ The spawned process still has to call :func:`limit_cuda_memory` with it.
104
247
  """
105
- total_bytes = torch.cuda.get_device_properties(None).total_memory
106
- if vram_limit_gb <= 0:
107
- return total_bytes
108
- return min(total_bytes, int(vram_limit_gb * 1024**3))
248
+ parser.add_argument(VRAM_LIMIT_GB_FLAG, type=float, default=0, help=VRAM_LIMIT_GB_HELP)
109
249
 
110
250
 
111
251
  def limit_cuda_memory(vram_limit_gb: float) -> None:
112
252
  """Cap how much of the GPU this process may allocate, to ``vram_limit_gb`` gigabytes.
113
253
 
114
254
  Call this once per process that touches the GPU, a spawned training process included: the
115
- cap does not survive the spawn.
255
+ cap does not survive the spawn. A probe in this process then measures against the same budget.
116
256
 
117
257
  :param vram_limit_gb: 0 or less means no cap.
118
258
  """
259
+ global _budget_gb # pylint: disable=global-statement
119
260
  if vram_limit_gb <= 0 or not torch.cuda.is_available():
120
261
  return
121
262
 
@@ -129,6 +270,7 @@ def limit_cuda_memory(vram_limit_gb: float) -> None:
129
270
  return
130
271
 
131
272
  torch.cuda.set_per_process_memory_fraction(fraction, None)
273
+ _budget_gb = vram_limit_gb
132
274
  logger.info('Limiting VRAM usage to %.1f GB of %.1f GB (%.0f%%)', vram_limit_gb, total_gb, fraction * 100)
133
275
 
134
276
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning_loop_node
3
- Version: 0.23.0
3
+ Version: 0.24.0
4
4
  Summary: Python Library for Nodes which connect to the Zauberzeug Learning Loop
5
5
  Author-email: Zauberzeug GmbH <info@zauberzeug.com>
6
6
  License: MIT
@@ -60,8 +60,10 @@ You can configure connection to our Learning Loop by specifying the following en
60
60
  | LOOP_PROJECT | PROJECT | Project ID | Detector | - |
61
61
  | MIN_UNCERTAIN_THRESHOLD | - | smallest confidence (float) at which auto-upload will happen | Detector (opt.) | 0.3 |
62
62
  | MAX_UNCERTAIN_THRESHOLD | - | largest confidence (float) at which auto-upload will happen | Detector (opt.) | 0.6 |
63
+ | MAX_OUTBOX_SIZE | - | max. number of non-priority images queued for upload | Detector (opt.) | 1000 |
63
64
  | EXCLUSIVE_MODEL_BUILD | - | Reject detections during update to save VRAM (set to 1) | Detector (opt.) | 0 |
64
65
  | INFERENCE_BATCH_SIZE | - | Batch size of trainer when calculating detections | Trainer (opt.) | 10 |
66
+ | VRAM_LIMIT_GB | - | GPU memory (GB) a training may use; the batch size is probed against it (`--vram-limit-gb`, trainers built with `node_parser(vram_limit=True)`) | Trainer (opt.) | 0 (whole card) |
65
67
  | RESTART_AFTER_TRAINING | - | Restart the trainer after training (set to 1) | Trainer (opt.) | 0 |
66
68
  | KEEP_OLD_TRAININGS | - | Do not delete old trainings (set to 1) | Trainer (opt.) | 0 |
67
69
  | TRAINER_IDLE_TIMEOUT_SEC | - | Automatically shutdown trainer after timeout (in seconds) | Trainer (opt.) | 0 (disabled) |
@@ -73,6 +75,16 @@ Where a name has an alias, either spelling works. If both are set to **different
73
75
  prefixed name wins and a warning names the value used — the variable is never treated as unset,
74
76
  which would otherwise let `LOOP_HOST` fall back to its default of `learning-loop.ai`.
75
77
 
78
+ #### Debug logging
79
+
80
+ Every node type (Detector, Trainer, Annotator, Converter) has a REST endpoint to switch its own log level between `INFO` and `DEBUG` at runtime. Send the plain text `on` or `off` with a PUT request:
81
+
82
+ - Turn debug logging on: `curl -X PUT -d "on" http://localhost/debug_logging`
83
+ - Turn debug logging off: `curl -X PUT -d "off" http://localhost/debug_logging`
84
+
85
+ The response repeats the new state. Any other body returns status code 400.
86
+ Only the node's own logger is affected; third-party loggers such as `httpx` keep their level. The setting is not persistent, a restart brings the log level back to `INFO`.
87
+
76
88
  #### Testing
77
89
 
78
90
  We use github actions for CI. Tests can also be executed locally by running
@@ -22,7 +22,7 @@ learning_loop_node/detector/detector_logic.py,sha256=XJaHNiw5PaHoCWnJ-qsxdUELLev
22
22
  learning_loop_node/detector/detector_node.py,sha256=GC5CaGcW_qVxyolDEz9U5W7y0ejZGEu9FZ__ckLxd7g,35728
23
23
  learning_loop_node/detector/exceptions.py,sha256=C6KbNPlSbtfgDrZx2Hbhm7Suk9jVoR3fMRCO0CkrMsQ,196
24
24
  learning_loop_node/detector/geometry.py,sha256=bZCF9xuK7qy6Ipv5aQYrTlwSmjaiUz5VEUYnc1zCe-w,1101
25
- learning_loop_node/detector/outbox.py,sha256=6F0MjFM-zNX-xWP_YGbmU0UYuyb0odsX_OcAxMPSzS0,12288
25
+ learning_loop_node/detector/outbox.py,sha256=HT0GHv6rsQzdbCD8DAT23m1-Q1XEvA_KgwAJLONyX_0,12506
26
26
  learning_loop_node/detector/postprocess.py,sha256=fPBbgE6Obkej709zoFPGqA2gnbJNbpbMuZogilKy4pI,7274
27
27
  learning_loop_node/detector/inbox_filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  learning_loop_node/detector/inbox_filter/cam_observation_history.py,sha256=slPGm87TbBCfDUdpRTAM5yOz1An8Br5X_2HFJOGSrFg,3540
@@ -42,15 +42,15 @@ learning_loop_node/enums/general.py,sha256=OSpcIpdFjuRByON2xBoiIXl1SgDREIqkwnaxk
42
42
  learning_loop_node/enums/trainer.py,sha256=VaD63guLO4aKgVfXT0EryPlXKQGegSET3Cp4R0uC_Ew,746
43
43
  learning_loop_node/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  learning_loop_node/helpers/background_tasks.py,sha256=sbbS8JO1ls0ZCbNW68KOT9QLOFyFoJRXwwAq78iOmoA,3256
45
- learning_loop_node/helpers/entrypoint.py,sha256=EtRMXZKzNapwbIylf4hg8Obw-2EydrLGKUjbIn5H-94,3591
45
+ learning_loop_node/helpers/entrypoint.py,sha256=U4vHFqgke6mXjDL-E4MND8RO7P1k2VBGwdDOOoJvD9Y,3915
46
46
  learning_loop_node/helpers/environment_reader.py,sha256=zsoFysxNxBCOJzUwX4Pbm3ftYhxx5zsbOHQfD9VcfvA,1937
47
47
  learning_loop_node/helpers/gdrive_downloader.py,sha256=zeYJciTAJVRpu_eFjwgYLCpIa6hU1d71anqEBb564Rk,1145
48
48
  learning_loop_node/helpers/log_conf.py,sha256=hqVAa_9NnYEU6N0dcOKmph82p7MpgKqeF_eomTLYzWY,961
49
49
  learning_loop_node/helpers/misc.py,sha256=qdN18Ukbw6eR6sFL4BxNq0EZzg2tVm2Cm8cTbFyy8QU,8931
50
50
  learning_loop_node/helpers/run.py,sha256=_uox-j3_K_bL3yCAwy3JYSOiIxrnhzVxyxWpCe8_J9U,876
51
51
  learning_loop_node/trainer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
- learning_loop_node/trainer/batch_size.py,sha256=Ma_nH3PHAk2gzqdkNXstNFqwXUUTt7pVe4aqWRrkHX4,2914
53
- learning_loop_node/trainer/cuda.py,sha256=LkXJaJ404S64XGRTMqqULB9e6g85dJfjLIAn12lnpTY,5968
52
+ learning_loop_node/trainer/batch_size.py,sha256=LjA-zyY4hdnSMy6ZsdQOhWbmd5H_DI-9LG3yFInv04E,5476
53
+ learning_loop_node/trainer/cuda.py,sha256=ehpfWqPBCVFu06SnGsjmWbSDRJ8sZc-L_nCtemRLUOU,12567
54
54
  learning_loop_node/trainer/downloader.py,sha256=AIyEKM4XYtd6VgmXrP3VayV9DpJzdURK1Brx81ePNSM,1470
55
55
  learning_loop_node/trainer/exceptions.py,sha256=IRT7qvn7-RjXaqL8mF21ySm7JWhQtqm1Cl0Gi3DChVY,540
56
56
  learning_loop_node/trainer/executor.py,sha256=XQ1TwgOF2pQv7bgzSaljDWG4I1ySjYXL8r9c_p9MX1Q,3947
@@ -63,7 +63,7 @@ learning_loop_node/trainer/trainer_logic_generic.py,sha256=IRP68ZGpnOX4OS03OwB7H
63
63
  learning_loop_node/trainer/trainer_node.py,sha256=ZnydfHJ2ehAhb821Xke_09qthCE3vDf7iqeYUrliSSo,4938
64
64
  learning_loop_node/trainer/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  learning_loop_node/trainer/rest/backdoor_controls.py,sha256=ZnK8ypY5r_q0-YZbtaOxhQThzuZvMsQHM5gJGESd_dE,5131
66
- learning_loop_node-0.23.0.dist-info/METADATA,sha256=L8ASHsKUg7Z_JGji4tqDJEbsCf44tZoKiPsZ4YeU6oo,17607
67
- learning_loop_node-0.23.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
68
- learning_loop_node-0.23.0.dist-info/top_level.txt,sha256=nS5qiFc4stVF_VXVCVJxZnrqVOv3IGX5-_E3sLby6OE,19
69
- learning_loop_node-0.23.0.dist-info/RECORD,,
66
+ learning_loop_node-0.24.0.dist-info/METADATA,sha256=rQNtas26mLdkkjI37mJ_jteRe7RtUO_3DpReanEUC2U,18609
67
+ learning_loop_node-0.24.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
68
+ learning_loop_node-0.24.0.dist-info/top_level.txt,sha256=nS5qiFc4stVF_VXVCVJxZnrqVOv3IGX5-_E3sLby6OE,19
69
+ learning_loop_node-0.24.0.dist-info/RECORD,,