nexaai 1.0.19rc3__cp310-cp310-macosx_14_0_universal2.whl → 1.0.19rc5__cp310-cp310-macosx_14_0_universal2.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 nexaai might be problematic. Click here for more details.

Binary file
nexaai/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is generated by CMake from _version.py.in
2
2
  # Do not modify this file manually - it will be overwritten
3
3
 
4
- __version__ = "1.0.19-rc3"
4
+ __version__ = "1.0.19-rc5"
Binary file
@@ -332,8 +332,133 @@ def create_mlx_manifest(repo_id: str, files: List[str], directory_path: str, old
332
332
  return manifest
333
333
 
334
334
 
335
- def detect_model_type(files: List[str]) -> str:
336
- """Detect if this is a GGUF or MLX model based on file extensions."""
335
+ def create_npu_manifest(repo_id: str, files: List[str], directory_path: str, old_metadata: Dict[str, Any], is_mmproj: bool = False, file_name: Optional[Union[str, List[str]]] = None, **kwargs) -> Dict[str, Any]:
336
+ """Create NPU format manifest."""
337
+
338
+ # Load existing manifest to merge NPU files if it exists
339
+ existing_manifest = load_nexa_manifest(directory_path)
340
+
341
+ # Check if there's a downloaded nexa.manifest from the repo
342
+ downloaded_manifest = old_metadata.get('downloaded_manifest', {})
343
+
344
+ model_files = {}
345
+ extra_files = []
346
+
347
+ # Initialize MMProjFile
348
+ mmproj_file = {
349
+ "Name": "",
350
+ "Downloaded": False,
351
+ "Size": 0
352
+ }
353
+
354
+ for current_file_name in files:
355
+ file_path = os.path.join(directory_path, current_file_name)
356
+ file_size = 0
357
+ if os.path.exists(file_path):
358
+ try:
359
+ file_size = os.path.getsize(file_path)
360
+ except (OSError, IOError):
361
+ pass
362
+
363
+ # Check if this file is an mmproj file
364
+ is_current_mmproj = 'mmproj' in current_file_name.lower()
365
+
366
+ # If we're downloading specific files and this is marked as mmproj, respect that
367
+ if is_mmproj and file_name is not None:
368
+ filenames_to_check = file_name if isinstance(file_name, list) else [file_name]
369
+ is_current_mmproj = current_file_name in filenames_to_check
370
+
371
+ if is_current_mmproj:
372
+ # This is an mmproj file, put it in MMProjFile
373
+ mmproj_file = {
374
+ "Name": current_file_name,
375
+ "Downloaded": True,
376
+ "Size": file_size
377
+ }
378
+ else:
379
+ # For NPU, all non-mmproj files go to extra_files
380
+ extra_files.append({
381
+ "Name": current_file_name,
382
+ "Downloaded": True,
383
+ "Size": file_size
384
+ })
385
+
386
+ # Pick the first file from extra_files and add it to ModelFile with key "N/A"
387
+ if extra_files:
388
+ first_file = extra_files[0]
389
+ model_files["N/A"] = {
390
+ "Name": first_file["Name"],
391
+ "Downloaded": first_file["Downloaded"],
392
+ "Size": first_file["Size"]
393
+ }
394
+
395
+ # Determine PluginId with priority: kwargs > downloaded_manifest > model_file_type > default
396
+ plugin_id = kwargs.get('plugin_id')
397
+ if not plugin_id:
398
+ model_file_type = old_metadata.get('model_file_type')
399
+ if downloaded_manifest.get('PluginId'):
400
+ plugin_id = downloaded_manifest.get('PluginId')
401
+ elif model_file_type:
402
+ plugin_id = _get_plugin_id_from_model_file_type(model_file_type)
403
+ else:
404
+ plugin_id = "npu"
405
+
406
+ # Determine ModelType with priority: kwargs > downloaded_manifest > pipeline_tag mapping
407
+ model_type = kwargs.get('model_type')
408
+ if not model_type:
409
+ if downloaded_manifest.get('ModelType'):
410
+ model_type = downloaded_manifest.get('ModelType')
411
+ else:
412
+ model_type = PIPELINE_TO_MODEL_TYPE.get(old_metadata.get('pipeline_tag'), "other")
413
+
414
+ # Determine ModelName with priority: kwargs > downloaded_manifest > empty string
415
+ model_name = kwargs.get('model_name')
416
+ if not model_name:
417
+ model_name = downloaded_manifest.get('ModelName', '')
418
+
419
+ # Get DeviceId and MinSDKVersion from kwargs or default to empty string
420
+ device_id = kwargs.get('device_id', '')
421
+ min_sdk_version = kwargs.get('min_sdk_version', '')
422
+
423
+ manifest = {
424
+ "Name": repo_id,
425
+ "ModelName": model_name,
426
+ "ModelType": model_type,
427
+ "PluginId": plugin_id,
428
+ "DeviceId": device_id,
429
+ "MinSDKVersion": min_sdk_version,
430
+ "ModelFile": model_files,
431
+ "MMProjFile": mmproj_file,
432
+ "TokenizerFile": {
433
+ "Name": "",
434
+ "Downloaded": False,
435
+ "Size": 0
436
+ },
437
+ "ExtraFiles": extra_files if extra_files else None,
438
+ # Preserve old metadata fields
439
+ "pipeline_tag": old_metadata.get('pipeline_tag') if old_metadata.get('pipeline_tag') else existing_manifest.get('pipeline_tag'),
440
+ "download_time": old_metadata.get('download_time') if old_metadata.get('download_time') else existing_manifest.get('download_time'),
441
+ "avatar_url": old_metadata.get('avatar_url') if old_metadata.get('avatar_url') else existing_manifest.get('avatar_url')
442
+ }
443
+
444
+ return manifest
445
+
446
+
447
+ def detect_model_type(files: List[str], old_metadata: Dict[str, Any] = None) -> str:
448
+ """Detect if this is a GGUF, MLX, or NPU model based on file extensions and metadata.
449
+
450
+ Args:
451
+ files: List of files in the model directory
452
+ old_metadata: Metadata dict that may contain 'model_file_type'
453
+
454
+ Returns:
455
+ Model type string: 'gguf', 'mlx', or 'npu'
456
+ """
457
+ # Check if model_file_type is explicitly set to NPU
458
+ if old_metadata and old_metadata.get('model_file_type') == 'npu':
459
+ return "npu"
460
+
461
+ # Otherwise, detect based on file extensions
337
462
  has_gguf = any(f.endswith('.gguf') for f in files)
338
463
  has_safetensors = any(f.endswith('.safetensors') or 'safetensors' in f for f in files)
339
464
 
@@ -354,7 +479,7 @@ def create_manifest_from_files(repo_id: str, files: List[str], directory_path: s
354
479
  repo_id: Repository ID
355
480
  files: List of files in the model directory
356
481
  directory_path: Path to the model directory
357
- old_metadata: Existing metadata (pipeline_tag, download_time, avatar_url)
482
+ old_metadata: Existing metadata (pipeline_tag, download_time, avatar_url, model_file_type)
358
483
  is_mmproj: Whether the downloaded file is an mmproj file
359
484
  file_name: The specific file(s) that were downloaded (None if entire repo was downloaded)
360
485
  **kwargs: Additional metadata including plugin_id, model_name, model_type, device_id, min_sdk_version
@@ -362,10 +487,12 @@ def create_manifest_from_files(repo_id: str, files: List[str], directory_path: s
362
487
  Returns:
363
488
  Dict containing the appropriate manifest format
364
489
  """
365
- model_type = detect_model_type(files)
490
+ model_type = detect_model_type(files, old_metadata)
366
491
 
367
492
  if model_type == "gguf":
368
493
  return create_gguf_manifest(repo_id, files, directory_path, old_metadata, is_mmproj, file_name, **kwargs)
494
+ elif model_type == "npu":
495
+ return create_npu_manifest(repo_id, files, directory_path, old_metadata, is_mmproj, file_name, **kwargs)
369
496
  else: # mlx or other
370
497
  return create_mlx_manifest(repo_id, files, directory_path, old_metadata, is_mmproj, file_name, **kwargs)
371
498
 
@@ -13,7 +13,7 @@ class ModelTypeMapping(Enum):
13
13
  """Enum for mapping HuggingFace pipeline_tag to our ModelType."""
14
14
  TEXT_GENERATION = ("text-generation", "llm")
15
15
  IMAGE_TEXT_TO_TEXT = ("image-text-to-text", "vlm")
16
- ANY_TO_ANY = ("any-to-any", "a2a")
16
+ ANY_TO_ANY = ("any-to-any", "ata")
17
17
  AUTOMATIC_SPEECH_RECOGNITION = ("automatic-speech-recognition", "asr")
18
18
 
19
19
  def __init__(self, pipeline_tag: str, model_type: str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nexaai
3
- Version: 1.0.19rc3
3
+ Version: 1.0.19rc5
4
4
  Summary: Python bindings for NexaSDK C-lib backend
5
5
  Author-email: "Nexa AI, Inc." <dev@nexa.ai>
6
6
  Project-URL: Homepage, https://github.com/NexaAI/nexasdk-bridge
@@ -1,6 +1,6 @@
1
1
  nexaai/__init__.py,sha256=L8oB7GFZZMGnUpCg0PecDbI_ycKuQak-ZEJ4Y12_QIw,2184
2
- nexaai/_stub.cpython-310-darwin.so,sha256=gU1-7T8bFDL1yl7mKFSMwcriX0RN_h9P4UptbbbIOKQ,66768
3
- nexaai/_version.py,sha256=biSqFffhgVgZ7_N05gIols4ugoQJvVDrVGL8JTj6o5c,143
2
+ nexaai/_stub.cpython-310-darwin.so,sha256=jf63NdYbs7Wv6p53PWKrd7y4gtNRomirR2pdY2sXu8M,66768
3
+ nexaai/_version.py,sha256=LMA557zx5P3hvpk0d7lsVKacPlWeQ9AVuVRclTomHtk,143
4
4
  nexaai/asr.py,sha256=NljMXDErwPNMOPaRkJZMEDka9Nk8xyur7L8i924TStY,2054
5
5
  nexaai/base.py,sha256=N8PRgDFA-XPku2vWnQIofQ7ipz3pPlO6f8YZGnuhquE,982
6
6
  nexaai/common.py,sha256=Y0NJNLTi4Nq4x1WL6PQsSvGUto0eGmWhjpsC6jcekfA,3444
@@ -19,7 +19,7 @@ nexaai/asr_impl/pybind_asr_impl.py,sha256=pE9Hb_hMi5yAc4MF83bLVOb8zDtreCkB3_u7XE
19
19
  nexaai/binds/__init__.py,sha256=eYuay_8DDXeOUWz2_R9HFSabohxs6hvZn391t2L0Po0,104
20
20
  nexaai/binds/common_bind.cpython-310-darwin.so,sha256=zxJuD0nSV--VZKxBfWZUavU7_bHj_JTi0FhkjvG4VJw,235264
21
21
  nexaai/binds/embedder_bind.cpython-310-darwin.so,sha256=tPa0c0Dv_GiW66fgmAGWGCHXRGNApznqoQS0eQx9GFM,202064
22
- nexaai/binds/libnexa_bridge.dylib,sha256=xJ72KZaM0M1fd9-GgkzrgShsdViSDqfThDZ_nujw-Sw,251192
22
+ nexaai/binds/libnexa_bridge.dylib,sha256=SMwmGIzFMbPVaqGiNFMAywQONO5mU78SaS7eUy8xBQA,251192
23
23
  nexaai/binds/llm_bind.cpython-310-darwin.so,sha256=TAWfa1Hzq00TjtC1xVsiAeLp6hv2LrL5afDz4omUghc,182784
24
24
  nexaai/binds/vlm_bind.cpython-310-darwin.so,sha256=nd6eG_m2EiPthzkSZ97hlXWUOZQir4cQfFJZ4p6eR2U,182704
25
25
  nexaai/binds/nexa_llama_cpp/libggml-base.dylib,sha256=JM4oOkie1su0ES5hMdtILeQHlRukRzH1vTleTupUXhg,650736
@@ -547,15 +547,15 @@ nexaai/tts_impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
547
547
  nexaai/tts_impl/mlx_tts_impl.py,sha256=i_uNPdvlXYtL3e01oKjDlP9jgkWCRt1bBHsExaaiJi8,3101
548
548
  nexaai/tts_impl/pybind_tts_impl.py,sha256=mpn44r6pfYLIl-NrEy2dXHjGtWtNCmM7HRyxiANxUI4,1444
549
549
  nexaai/utils/decode.py,sha256=61n4Zf6c5QLyqGoctEitlI9BX3tPlP2a5aaKNHbw3T4,404
550
- nexaai/utils/manifest_utils.py,sha256=Teji_i_ZG0IkiKWNKKwCq1j_a2k406db7bnd_MC4nu0,16195
550
+ nexaai/utils/manifest_utils.py,sha256=SCcFN09xNI0DiTA1U7DZwWiQsRH0CInWSny_9q0BwNM,21273
551
551
  nexaai/utils/model_manager.py,sha256=NnbPv1iuwo6T523gLsWjnff-gGvPGUjez-rFg8-ffpE,59568
552
- nexaai/utils/model_types.py,sha256=9Q95icWn22jIUoY2eIEdIiXBBGJSGZlXXSbox0xXWNQ,1483
552
+ nexaai/utils/model_types.py,sha256=ONWjjo8CFPdhxki6qo7MXnSZaEzjBcxa_Kkf_y5NXus,1483
553
553
  nexaai/utils/progress_tracker.py,sha256=jdUqtmPqyhwC9uSKvQcJEYETwSt-OhP4oitdJ94614o,15394
554
554
  nexaai/utils/quantization_utils.py,sha256=FYcNSAKGlBqFDUTx3jSKOr2lnq4nyiyC0ZG8oSxFwiU,7825
555
555
  nexaai/vlm_impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
556
556
  nexaai/vlm_impl/mlx_vlm_impl.py,sha256=pLtWm_ckz8a0U-AtAOMVseFDO4OVPvHyYO2KlfBaGYk,10833
557
557
  nexaai/vlm_impl/pybind_vlm_impl.py,sha256=FAbhpRJzHgI78r0mUvKybO97R1szvNhH0aTn_I52oT4,8597
558
- nexaai-1.0.19rc3.dist-info/METADATA,sha256=mK5fFMBrvvErJcvUuUkSXWqJ8kBemVHKYKzYDGZVhfs,1201
559
- nexaai-1.0.19rc3.dist-info/WHEEL,sha256=T2p57lol9__xkoU6aJTyN1Pm43ZpRU3q6km7mIbrAMs,114
560
- nexaai-1.0.19rc3.dist-info/top_level.txt,sha256=LRE2YERlrZk2vfuygnSzsEeqSknnZbz3Z1MHyNmBU4w,7
561
- nexaai-1.0.19rc3.dist-info/RECORD,,
558
+ nexaai-1.0.19rc5.dist-info/METADATA,sha256=uxc1JkJYwh1ZVFYNk7W7_95zmk6PAUvXBEnIGH700sU,1201
559
+ nexaai-1.0.19rc5.dist-info/WHEEL,sha256=T2p57lol9__xkoU6aJTyN1Pm43ZpRU3q6km7mIbrAMs,114
560
+ nexaai-1.0.19rc5.dist-info/top_level.txt,sha256=LRE2YERlrZk2vfuygnSzsEeqSknnZbz3Z1MHyNmBU4w,7
561
+ nexaai-1.0.19rc5.dist-info/RECORD,,