learning-loop-node 0.18.4__py3-none-any.whl → 0.18.5__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.
@@ -38,10 +38,11 @@ class DetectorLogic():
38
38
  self.init()
39
39
  logging.info('Successfully loaded model %s', self.model_info)
40
40
  self._remaining_init_attempts = 2
41
- except Exception:
41
+ except Exception as e:
42
42
  self._remaining_init_attempts -= 1
43
+ logging.error('Could not init model %s. Retries left: %s. Error: %s',
44
+ self.model_info, self._remaining_init_attempts, e)
43
45
  self.model_info = None
44
- logging.error('Could not init model %s. Retries left: %s', self.model_info, self._remaining_init_attempts)
45
46
  if self._remaining_init_attempts == 0:
46
47
  raise NodeNeedsRestartError('Could not init model') from None
47
48
  raise
@@ -60,11 +60,22 @@ def _handle_task_result(task: asyncio.Task,
60
60
 
61
61
 
62
62
  def get_free_memory_mb() -> float: # NOTE used by yolov5
63
- pynvml.nvmlInit()
64
- h = pynvml.nvmlDeviceGetHandleByIndex(0)
65
- info = pynvml.nvmlDeviceGetMemoryInfo(h)
66
- free = float(info.free) / 1024 / 1024
67
- return free
63
+ """
64
+ Get the free memory available to the graphics card (index 0) in MB.
65
+ If VRAM information is unavailable, for example if the system shares ram
66
+ between CPU and GPU, the available RAM is returned instead.
67
+ """
68
+ try:
69
+ pynvml.nvmlInit()
70
+
71
+ h = pynvml.nvmlDeviceGetHandleByIndex(0)
72
+ info = pynvml.nvmlDeviceGetMemoryInfo(h)
73
+ free_mb = float(info.free) / 1024 / 1024
74
+ except pynvml.nvml.NVMLError:
75
+ logger = logging.getLogger(__name__)
76
+ logger.warning('Could not get GPU memory info, returning free CPU memory instead')
77
+ free_mb = float(os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_AVPHYS_PAGES')) / 1024 / 1024
78
+ return free_mb
68
79
 
69
80
 
70
81
  async def is_valid_image(filename: str, check_jpeg: bool) -> bool:
@@ -173,7 +173,7 @@ class ActiveTrainingIO:
173
173
  response = await self.loop_communicator.post(
174
174
  f'/{context.organization}/projects/{context.project}/detections', json=detections_json)
175
175
  if response.status_code != 200:
176
- msg = f'could not upload detections. {str(response)}'
176
+ msg = f'could not upload detections. HTTP {response.status_code}: {response.text}'
177
177
  logging.error(msg)
178
178
  raise Exception(msg)
179
179
 
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning_loop_node
3
- Version: 0.18.4
3
+ Version: 0.18.5
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
7
7
  Project-URL: Repository, https://github.com/zauberzeug/learning_loop_node
8
- Requires-Python: >=3.9
8
+ Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  Requires-Dist: fastapi<1.0,>=0.128
11
11
  Requires-Dist: uvicorn[standard]<0.23.0,>=0.22.0
@@ -17,7 +17,7 @@ Requires-Dist: icecream<3.0.0,>=2.1.0
17
17
  Requires-Dist: aiofiles<0.8.0,>=0.7.0
18
18
  Requires-Dist: async_generator<2.0.0,>=1.10
19
19
  Requires-Dist: pytest-watch<5.0.0,>=4.2.0
20
- Requires-Dist: python-multipart<0.0.19,>=0.0.18
20
+ Requires-Dist: python-multipart>=0.0.22
21
21
  Requires-Dist: psutil<6.0.0,>=5.8.0
22
22
  Requires-Dist: numpy<3.0,>=2.0
23
23
  Requires-Dist: Pillow<12.0.0,>=11.0.0
@@ -17,7 +17,7 @@ learning_loop_node/data_classes/image_metadata.py,sha256=4FFs89iZAfr2Jh-40QqZ_GG
17
17
  learning_loop_node/data_classes/socket_response.py,sha256=tIdt-oYf6ULoJIDYQCecNM9OtWR6_wJ9tL0Ksu83Vko,655
18
18
  learning_loop_node/data_classes/training.py,sha256=TybwcCDf_NUaDUaOj30lPm-7Z3Qk9XFRibEX5qIv96Y,5737
19
19
  learning_loop_node/detector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- learning_loop_node/detector/detector_logic.py,sha256=8J70Fulrhex9IHFBAGYLR3a0-W-zsNj4h7mYLnrmUqM,2899
20
+ learning_loop_node/detector/detector_logic.py,sha256=F-w5Q9Ov50YQghq5Q4QesXkByf5bYmGhwdfkS1QxOtg,2944
21
21
  learning_loop_node/detector/detector_node.py,sha256=g1moqT-d6I6pNv7XKweUT47P4QY53XdwRme_qXYFrBc,31805
22
22
  learning_loop_node/detector/exceptions.py,sha256=C6KbNPlSbtfgDrZx2Hbhm7Suk9jVoR3fMRCO0CkrMsQ,196
23
23
  learning_loop_node/detector/outbox.py,sha256=6F0MjFM-zNX-xWP_YGbmU0UYuyb0odsX_OcAxMPSzS0,12288
@@ -42,20 +42,20 @@ learning_loop_node/helpers/background_tasks.py,sha256=sbbS8JO1ls0ZCbNW68KOT9QLOF
42
42
  learning_loop_node/helpers/environment_reader.py,sha256=6DxDJecLHxiGczByhyVa_JssAwwft7vuNCGaEzoSY2I,1662
43
43
  learning_loop_node/helpers/gdrive_downloader.py,sha256=zeYJciTAJVRpu_eFjwgYLCpIa6hU1d71anqEBb564Rk,1145
44
44
  learning_loop_node/helpers/log_conf.py,sha256=hqVAa_9NnYEU6N0dcOKmph82p7MpgKqeF_eomTLYzWY,961
45
- learning_loop_node/helpers/misc.py,sha256=bHIYeOoX_5FA1qhcNlG7_kVgVXDF5jipByDwTvs8Huw,8407
45
+ learning_loop_node/helpers/misc.py,sha256=Lw1gr7CdyTJbrv44bsFNXWtGVDCRQrpcDIJsIrKjtqU,8936
46
46
  learning_loop_node/helpers/run.py,sha256=_uox-j3_K_bL3yCAwy3JYSOiIxrnhzVxyxWpCe8_J9U,876
47
47
  learning_loop_node/trainer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  learning_loop_node/trainer/downloader.py,sha256=AIyEKM4XYtd6VgmXrP3VayV9DpJzdURK1Brx81ePNSM,1470
49
49
  learning_loop_node/trainer/exceptions.py,sha256=vbuoE6kssLQuA8zd3LiDHmZglP6E2IJJwEi5AZtWXxY,420
50
50
  learning_loop_node/trainer/executor.py,sha256=XQ1TwgOF2pQv7bgzSaljDWG4I1ySjYXL8r9c_p9MX1Q,3947
51
- learning_loop_node/trainer/io_helpers.py,sha256=ZnAPVqhq8XCHe1NoiOQJ_w0B-estcc8CBQHnb423UDw,7226
51
+ learning_loop_node/trainer/io_helpers.py,sha256=zWl0-HLP8zxOG3ybm76vXgEozULj_1QRl95jkrF126k,7255
52
52
  learning_loop_node/trainer/test_executor.py,sha256=6BVGDN_6f5GEMMEvDLSG1yzMybSvgXaP5uYpSfsVPP0,2224
53
53
  learning_loop_node/trainer/trainer_logic.py,sha256=eK-01qZzi10UjLMCQX8vy5eW2FoghPj3rzzDC-s3Si4,8792
54
54
  learning_loop_node/trainer/trainer_logic_generic.py,sha256=KcHmXr-Hp8_Wuejzj8odY6sRPqi6aw1SEXv3YlbjM98,27057
55
55
  learning_loop_node/trainer/trainer_node.py,sha256=tsAMzJewdS7Bi_1b9FwG0d2lGlv2lY37pgOLWr0bP_I,4582
56
56
  learning_loop_node/trainer/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  learning_loop_node/trainer/rest/backdoor_controls.py,sha256=ZnK8ypY5r_q0-YZbtaOxhQThzuZvMsQHM5gJGESd_dE,5131
58
- learning_loop_node-0.18.4.dist-info/METADATA,sha256=V9kzX_sICIu_uGtGUYzFJT8UYxkcyVPJ63LCkW0jzJA,15017
59
- learning_loop_node-0.18.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
- learning_loop_node-0.18.4.dist-info/top_level.txt,sha256=nS5qiFc4stVF_VXVCVJxZnrqVOv3IGX5-_E3sLby6OE,19
61
- learning_loop_node-0.18.4.dist-info/RECORD,,
58
+ learning_loop_node-0.18.5.dist-info/METADATA,sha256=yw9uvfHJEECQVD_sVjeETiAo4y_MDbU4H0uAbC6ijws,15010
59
+ learning_loop_node-0.18.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
60
+ learning_loop_node-0.18.5.dist-info/top_level.txt,sha256=nS5qiFc4stVF_VXVCVJxZnrqVOv3IGX5-_E3sLby6OE,19
61
+ learning_loop_node-0.18.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5