lemonade-sdk 8.1.8__py3-none-any.whl → 8.1.10__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 lemonade-sdk might be problematic. Click here for more details.

lemonade/cli.py CHANGED
@@ -12,6 +12,41 @@ from lemonade.sequence import Sequence
12
12
  from lemonade.tools.management_tools import Cache, Version, SystemInfo
13
13
  from lemonade.state import State
14
14
 
15
+
16
+ def get_available_profilers(warn_missing=False):
17
+ """Get list of available profilers, with conditional imports for optional dependencies.
18
+
19
+ Args:
20
+ warn_missing: If True, print warnings for missing profilers. If False, fail silently.
21
+ """
22
+ profilers = [MemoryTracker]
23
+
24
+ try:
25
+ from lemonade.profilers.hwinfo_power import HWINFOPowerProfiler
26
+
27
+ profilers.append(HWINFOPowerProfiler)
28
+ except ImportError:
29
+ if warn_missing:
30
+ print(
31
+ "Warning: HWINFOPowerProfiler not available. "
32
+ "Install lemonade with dev extras: "
33
+ "pip install lemonade-sdk[dev]"
34
+ )
35
+ try:
36
+ from lemonade.profilers.agt_power import AGTPowerProfiler
37
+
38
+ profilers.append(AGTPowerProfiler)
39
+ except ImportError:
40
+ if warn_missing:
41
+ print(
42
+ "Warning: AGTPowerProfiler not available. "
43
+ "Install lemonade with dev extras: "
44
+ "pip install lemonade-sdk[dev]"
45
+ )
46
+
47
+ return profilers
48
+
49
+
15
50
  from lemonade.tools.huggingface.load import HuggingfaceLoad
16
51
  from lemonade.tools.huggingface.bench import HuggingfaceBench
17
52
  from lemonade.tools.oga.load import OgaLoad
@@ -51,7 +86,7 @@ def main():
51
86
  ]
52
87
 
53
88
  # List the available profilers
54
- profilers = [MemoryTracker]
89
+ profilers = get_available_profilers()
55
90
 
56
91
  # Define the argument parser
57
92
  parser = cli.CustomArgumentParser(
@@ -85,6 +120,17 @@ https://github.com/lemonade-sdk/lemonade/blob/main/docs/README.md""",
85
120
  parser, tools, cli_name="lemonade"
86
121
  )
87
122
 
123
+ # Check if any profilers are being requested
124
+ requested_profilers = [
125
+ profiler.unique_name.replace("-", "_")
126
+ for profiler in profilers
127
+ if global_args.get(profiler.unique_name.replace("-", "_"), None) is not None
128
+ ]
129
+
130
+ # If profilers are requested, get the full list with warnings for missing ones
131
+ if requested_profilers:
132
+ get_available_profilers(warn_missing=True)
133
+
88
134
  profiler_instances = [
89
135
  profiler(global_args[profiler.unique_name.replace("-", "_")])
90
136
  for profiler in profilers
@@ -24,7 +24,7 @@ class InferenceEngineDetector:
24
24
  Detect all available inference engines for a specific device type.
25
25
 
26
26
  Args:
27
- device_type: "cpu", "amd_igpu", "amd_dgpu", or "npu"
27
+ device_type: "cpu", "amd_igpu", "amd_dgpu", "nvidia_dgpu", or "npu"
28
28
 
29
29
  Returns:
30
30
  dict: Engine availability information
@@ -223,17 +223,26 @@ class LlamaCppDetector(BaseEngineDetector):
223
223
  """
224
224
  try:
225
225
 
226
- if device_type not in ["cpu", "amd_igpu", "amd_dgpu"]:
226
+ if device_type not in ["cpu", "amd_igpu", "amd_dgpu", "nvidia_dgpu"]:
227
227
  return None
228
228
 
229
229
  # Check if the device is supported by the backend
230
230
  if device_type == "cpu":
231
231
  device_supported = True
232
- elif device_type == "amd_igpu" or device_type == "amd_dgpu":
232
+ elif device_type in ["amd_igpu", "amd_dgpu"]:
233
233
  if backend == "vulkan":
234
234
  device_supported = self._check_vulkan_support()
235
235
  elif backend == "rocm":
236
236
  device_supported = self._check_rocm_support(device_name.lower())
237
+ else:
238
+ device_supported = False
239
+ elif device_type == "nvidia_dgpu":
240
+ if backend == "vulkan":
241
+ device_supported = self._check_vulkan_support()
242
+ else:
243
+ device_supported = False
244
+ else:
245
+ device_supported = False
237
246
  if not device_supported:
238
247
  return {"available": False, "error": f"{backend} not available"}
239
248
 
@@ -390,7 +399,7 @@ def detect_inference_engines(device_type: str, device_name: str) -> Dict[str, Di
390
399
  Helper function to detect inference engines for a device type.
391
400
 
392
401
  Args:
393
- device_type: "cpu", "amd_igpu", "amd_dgpu", or "npu"
402
+ device_type: "cpu", "amd_igpu", "amd_dgpu", "nvidia_dgpu", or "npu"
394
403
  device_name: device name
395
404
 
396
405
  Returns: