aipmodel 0.2.40__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.
aipmodel/template.py ADDED
@@ -0,0 +1,67 @@
1
+ from dotenv import load_dotenv
2
+ from aipmodel.model_registry import MLOpsManager
3
+
4
+ load_dotenv()
5
+
6
+ manager = MLOpsManager(
7
+ # The following values will be picked up from the environment variables (.env) by default.
8
+ # You can uncomment and provide your own values below to override them.
9
+
10
+ # CLEARML_API_SERVER_URL="your-endpoint_url",
11
+ # CLEARML_USERNAME="your-clearml-username",
12
+ # CLEARML_ACCESS_KEY="your-clearml-access-key",
13
+ # CLEARML_SECRET_KEY="your-clearml-secret-key",
14
+ verbose=False # Set to False to reduce logging output
15
+ )
16
+
17
+ # STEP 2: Upload local model
18
+ print("\n--- STEP 2: Upload local model ---")
19
+ local_model_id = manager.add_model(
20
+ source_type="local",
21
+ model_name="your_local_model",
22
+ source_path="path/to/your/local/model/folder",
23
+ code_path="path/to/your/local/model/model.py", # Optional
24
+ )
25
+ print(f"Local Model ID: {local_model_id}\n")
26
+
27
+ # STEP 3: Upload HuggingFace model
28
+ print("\n--- STEP 3: uUpload HuggingFace model ---")
29
+ hf_model_id = manager.add_model(
30
+ source_type="hf",
31
+ model_name="your_hf_model",
32
+ source_path="facebook/wav2vec2-base-960h"
33
+ )
34
+ print(f"HuggingFace Model ID: {hf_model_id}\n")
35
+
36
+ # STEP 4: Upload model from your own S3 (e.g., AWS S3, MinIO, or Ceph)
37
+ print("\n--- STEP 4: Upload model from your own S3 ---")
38
+ s3_model_id = manager.add_model(
39
+ source_type="s3",
40
+ model_name="your_s3_model",
41
+ source_path="path/in/your/bucket/", # Path to model in S3 bucket
42
+ code_path="path/to/your/local/model/model.py", # Optional, remove if not using a script
43
+ external_ceph_endpoint_url="http://your-s3-endpoint.com", # Example: "http://s3.example.com"
44
+ external_ceph_bucket_name="your-s3-bucket",
45
+ external_ceph_access_key="your-s3-access-key",
46
+ external_ceph_secret_key="your-s3-secret-key"
47
+ )
48
+ print(f"S3 Model ID: {s3_model_id}\n")
49
+
50
+ # STEP 5: Download a model locally
51
+ print("\n--- STEP 5: Download a model locally ---")
52
+ manager.get_model(
53
+ model_name="your_hf_model", # or any valid model name
54
+ local_dest="./downloaded_model/",
55
+ )
56
+
57
+ # STEP 6: List all models in your AIP project
58
+ print("\n--- STEP 6: List all models ---")
59
+ manager.list_models()
60
+
61
+ # STEP 7: Get model information
62
+ print("\n--- STEP 7: Get model information ---")
63
+ manager.get_model_info("your_hf_model")
64
+
65
+ # STEP 8: Delete a model
66
+ print("\n--- STEP 8: Delete a model ---")
67
+ manager.delete_model(model_id=local_model_id)
@@ -0,0 +1,17 @@
1
+ import importlib.metadata
2
+
3
+ import requests
4
+
5
+
6
+ def check_latest_version(package_name="aipmodel", auto_warn=True):
7
+ try:
8
+ current_version = importlib.metadata.version(package_name)
9
+ response = requests.get(f"https://pypi.org/pypi/{package_name}/json", timeout=5)
10
+ latest_version = response.json()["info"]["version"]
11
+ if current_version != latest_version:
12
+ if auto_warn:
13
+ print(f"[Update] A newer version ({latest_version}) is available. You are using {current_version}.")
14
+ return False, current_version, latest_version
15
+ return True, current_version, latest_version
16
+ except Exception:
17
+ return None, None, None
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: aipmodel
3
+ Version: 0.2.40
4
+ Summary: SDK for model registration, versioning, and storage
5
+ Home-page: https://github.com/AIP-MLOPS/model-registry
6
+ Author: AIP MLOPS Team
7
+ Author-email: mohmmadweb@gmail.com
8
+ Requires-Python: >=3.6
9
+ Requires-Dist: boto3>=1.40.11
10
+ Requires-Dist: clearml>=2.0.2
11
+ Requires-Dist: fastapi>=0.115.0
12
+ Requires-Dist: hf_xet
13
+ Requires-Dist: huggingface-hub>=0.34.4
14
+ Requires-Dist: pydantic>=2.9.2
15
+ Requires-Dist: python-dotenv>=1.1.1
16
+ Requires-Dist: requests>=2.32.4
17
+ Requires-Dist: tabulate>=0.9.0
18
+ Requires-Dist: tqdm>=4.67.1
19
+ Requires-Dist: ruff
20
+ Requires-Dist: uvicorn[standard]>=0.30.6
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: home-page
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
@@ -0,0 +1,9 @@
1
+ aipmodel/CephS3Manager.py,sha256=wXd2UZTCWQDiT5TlZ5ftiXepHNBbzmluCyDcfcJdnd8,62124
2
+ aipmodel/__init__.py,sha256=RjQjSCto30jJ_XZrDFTCzAcAAYRyQhISnzjXKbIMEmk,424
3
+ aipmodel/model_registry.py,sha256=jK-q5KLlG0KmenRYGRXoV5ypnhsxO4--PRX6FRfJEhY,42411
4
+ aipmodel/template.py,sha256=wwCxtawHZUmKnH3SGczs_wWHIBRmFlPZel2gSmSEZWg,2392
5
+ aipmodel/update_checker.py,sha256=Jca6wpbRKKPuMC7D-OW7a-EmwRpDwGL49CKloKbKaM0,691
6
+ aipmodel-0.2.40.dist-info/METADATA,sha256=tq9VJIkbCcqgGG6CZ3KtMfoJPiCb11ZdNmVyZCs8fDY,744
7
+ aipmodel-0.2.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ aipmodel-0.2.40.dist-info/top_level.txt,sha256=tCr0ZQgD1flFh3E9rxe4oN0IxpEse4RGcqB0l8hOlF4,9
9
+ aipmodel-0.2.40.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ aipmodel