gmicloud 0.1.4__py3-none-any.whl → 0.1.6__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.
- gmicloud/__init__.py +12 -1
- gmicloud/_internal/_client/_artifact_client.py +126 -56
- gmicloud/_internal/_client/_http_client.py +5 -1
- gmicloud/_internal/_client/_iam_client.py +107 -42
- gmicloud/_internal/_client/_task_client.py +75 -30
- gmicloud/_internal/_enums.py +13 -0
- gmicloud/_internal/_manager/_artifact_manager.py +100 -5
- gmicloud/_internal/_manager/_iam_manager.py +36 -0
- gmicloud/_internal/_manager/_task_manager.py +88 -12
- gmicloud/_internal/_models.py +121 -12
- gmicloud/client.py +194 -69
- gmicloud/tests/test_artifacts.py +14 -15
- gmicloud/tests/test_tasks.py +1 -1
- gmicloud-0.1.6.dist-info/METADATA +147 -0
- gmicloud-0.1.6.dist-info/RECORD +27 -0
- {gmicloud-0.1.4.dist-info → gmicloud-0.1.6.dist-info}/WHEEL +1 -1
- gmicloud-0.1.4.dist-info/METADATA +0 -250
- gmicloud-0.1.4.dist-info/RECORD +0 -26
- {gmicloud-0.1.4.dist-info → gmicloud-0.1.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
gmicloud/__init__.py,sha256=aIgu4MAw4nExv781-pzSZLG8MscqAMZ5lM5fGyqg7QU,984
|
2
|
+
gmicloud/client.py,sha256=G0tD0xQnpqDKS-3l-AAU-K3FAHOsqsTzsAq2NVxiamY,10539
|
3
|
+
gmicloud/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
gmicloud/_internal/_config.py,sha256=qIH76TSyS3MQWe62LHI46RJhDnklNFisdajY75oUAqE,218
|
5
|
+
gmicloud/_internal/_constants.py,sha256=Y085dwFlqdFkCf39iBfxz39QiiB7lX59ayNJjB86_m4,378
|
6
|
+
gmicloud/_internal/_enums.py,sha256=5d6Z8TFJYCmhNI1TDbPpBbG1tNe96StIEH4tEw20RZk,789
|
7
|
+
gmicloud/_internal/_exceptions.py,sha256=hScBq7n2fOit4_umlkabZJchY8zVbWSRfWM2Y0rLCbw,306
|
8
|
+
gmicloud/_internal/_models.py,sha256=eArBzdhiMosLVZVUyoE_mvfxRS8yKPkuqhlDaa57Iog,17863
|
9
|
+
gmicloud/_internal/_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
gmicloud/_internal/_client/_artifact_client.py,sha256=-CyMdTauVovuv3whs8yUqmv3-WW2e9m2GoEG9D6eNbc,8374
|
11
|
+
gmicloud/_internal/_client/_decorator.py,sha256=sy4gxzsUB6ORXHw5pqmMf7TTlK41Nmu1fhIhK2AIsbY,670
|
12
|
+
gmicloud/_internal/_client/_file_upload_client.py,sha256=1JRs4X57S3EScPIP9w2DC1Uo6_Wbcjumcw3nVM7uIGM,4667
|
13
|
+
gmicloud/_internal/_client/_http_client.py,sha256=j--3emTjJ_l9CTdnkTbcpf7gYcUEl341pv2O5cU67l0,5741
|
14
|
+
gmicloud/_internal/_client/_iam_client.py,sha256=pgOXIqp9aJvcIUCEVkYPEyMUyxBftecojHAbs8Gbl94,7013
|
15
|
+
gmicloud/_internal/_client/_task_client.py,sha256=69OqZC_kwSDkTSVVyi51Tn_OyUV6R0nin4z4gLfZ-Lg,6141
|
16
|
+
gmicloud/_internal/_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
+
gmicloud/_internal/_manager/_artifact_manager.py,sha256=TBvGps__Kk1Ym7jztY3tNZ3XomKPrDIFPV7XyyLwHuw,15941
|
18
|
+
gmicloud/_internal/_manager/_iam_manager.py,sha256=nAqPCaUfSXTnx2MEQa8e0YUOBFYWDRiETgK1PImdf4o,1167
|
19
|
+
gmicloud/_internal/_manager/_task_manager.py,sha256=YDUcAdRkJhGumA1LLfpXfYs6jmLnev8P27UItPZHUBs,11268
|
20
|
+
gmicloud/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
gmicloud/tests/test_artifacts.py,sha256=q1jiTk5DN4G3LCLCO_8KbWArdc6RG3sETe1MCEt-vbI,16979
|
22
|
+
gmicloud/tests/test_tasks.py,sha256=yL-aFf80ShgTyxEONTWh-xbWDf5XnUNtIeA5hYvhKM0,10963
|
23
|
+
gmicloud/utils/uninstall_packages.py,sha256=zzuuaJPf39oTXWZ_7tUAGseoxocuCbbkoglJSD5yDrE,1127
|
24
|
+
gmicloud-0.1.6.dist-info/METADATA,sha256=rqwbl1_3RfzhdBpn9eb3u1My3pk10k7T3r23oEiTshY,4675
|
25
|
+
gmicloud-0.1.6.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
26
|
+
gmicloud-0.1.6.dist-info/top_level.txt,sha256=AZimLw3y0WPpLiSiOidZ1gD0dxALh-jQNk4fxC05hYE,9
|
27
|
+
gmicloud-0.1.6.dist-info/RECORD,,
|
@@ -1,250 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: gmicloud
|
3
|
-
Version: 0.1.4
|
4
|
-
Summary: GMI Cloud Python SDK
|
5
|
-
Author-email: GMI <gmi@gmitec.net>
|
6
|
-
License: MIT
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Classifier: Operating System :: OS Independent
|
10
|
-
Requires-Python: >=3.6
|
11
|
-
Description-Content-Type: text/markdown
|
12
|
-
|
13
|
-
# GMICloud SDK (Beta)
|
14
|
-
|
15
|
-
## Overview
|
16
|
-
|
17
|
-
Before you start: Our service and GPU resource is currenly invite-only so please contact our team (
|
18
|
-
getstarted@gmicloud.ai) to get invited if you don't have one yet.
|
19
|
-
|
20
|
-
The GMI Inference Engine SDK provides a Python interface for deploying and managing machine learning models in
|
21
|
-
production environments. It allows users to create model artifacts, schedule tasks for serving models, and call
|
22
|
-
inference APIs easily.
|
23
|
-
|
24
|
-
This SDK streamlines the process of utilizing GMI Cloud capabilities such as deploying models with Kubernetes-based Ray
|
25
|
-
services, managing resources automatically, and accessing model inference endpoints. With minimal setup, developers can
|
26
|
-
focus on building ML solutions instead of infrastructure.
|
27
|
-
|
28
|
-
## Features
|
29
|
-
|
30
|
-
- Artifact Management: Easily create, update, and manage ML model artifacts.
|
31
|
-
- Task Management: Quickly create, schedule, and manage deployment tasks for model inference.
|
32
|
-
- Usage Data Retrieval : Fetch and analyze usage data to optimize resource allocation.
|
33
|
-
|
34
|
-
## Installation
|
35
|
-
|
36
|
-
To install the SDK, use pip:
|
37
|
-
|
38
|
-
```bash
|
39
|
-
pip install gmicloud
|
40
|
-
```
|
41
|
-
|
42
|
-
## Setup
|
43
|
-
|
44
|
-
You must configure authentication credentials for accessing the GMI Cloud API. There are two ways to configure the SDK:
|
45
|
-
|
46
|
-
### Option 1: Using Environment Variables
|
47
|
-
|
48
|
-
Set the following environment variables:
|
49
|
-
|
50
|
-
```shell
|
51
|
-
export GMI_CLOUD_CLIENT_ID=<YOUR_CLIENT_ID>
|
52
|
-
export GMI_CLOUD_EMAIL=<YOUR_EMAIL>
|
53
|
-
export GMI_CLOUD_PASSWORD=<YOUR_PASSWORD>
|
54
|
-
```
|
55
|
-
|
56
|
-
### Option 2: Passing Credentials as Parameters
|
57
|
-
|
58
|
-
Pass `client_id`, `email`, and `password` directly to the Client object when initializing it in your script:
|
59
|
-
|
60
|
-
```python
|
61
|
-
from gmicloud import Client
|
62
|
-
|
63
|
-
client = Client(client_id="<YOUR_CLIENT_ID>", email="<YOUR_EMAIL>", password="<YOUR_PASSWORD>")
|
64
|
-
```
|
65
|
-
|
66
|
-
## Quick Start
|
67
|
-
|
68
|
-
### 1. How to run the code in the example folder
|
69
|
-
```bash
|
70
|
-
cd path/to/gmicloud-sdk
|
71
|
-
# Create a virtual environment
|
72
|
-
python -m venv venv
|
73
|
-
source venv/bin/activate
|
74
|
-
|
75
|
-
pip install -r requirements.txt
|
76
|
-
python -m examples.<example_name>
|
77
|
-
```
|
78
|
-
|
79
|
-
### 2. Create a Task from an Artifact Template
|
80
|
-
|
81
|
-
This is the simplest example to deploy an existing artifact template:
|
82
|
-
|
83
|
-
```python
|
84
|
-
from datetime import datetime
|
85
|
-
from gmicloud import Client, TaskScheduling, OneOffScheduling
|
86
|
-
from examples.completion import call_chat_completion
|
87
|
-
|
88
|
-
# Initialize the client
|
89
|
-
client = Client()
|
90
|
-
|
91
|
-
# Schedule and start a task from an artifact template
|
92
|
-
task = client.create_task_from_artifact_template(
|
93
|
-
"qwen_2.5_14b_instruct_template_001",
|
94
|
-
TaskScheduling(
|
95
|
-
scheduling_oneoff=OneOffScheduling(
|
96
|
-
trigger_timestamp=int(datetime.now().timestamp()) + 10, # Delay by 10 seconds
|
97
|
-
min_replicas=1,
|
98
|
-
max_replicas=10,
|
99
|
-
)
|
100
|
-
)
|
101
|
-
)
|
102
|
-
|
103
|
-
# Make a chat completion request via the task endpoint
|
104
|
-
response = call_chat_completion(client, task.task_id)
|
105
|
-
print(response)
|
106
|
-
```
|
107
|
-
|
108
|
-
### 3. Step-by-Step Example: Create Artifact, Task, and Query the Endpoint
|
109
|
-
|
110
|
-
#### (a) Create an Artifact from a Template
|
111
|
-
|
112
|
-
First, you’ll retrieve all templates and create an artifact based on the desired template (e.g., "Llama3.1 8B"):
|
113
|
-
|
114
|
-
```python
|
115
|
-
from gmicloud import *
|
116
|
-
|
117
|
-
def create_artifact_from_template(client: Client) -> str:
|
118
|
-
artifact_manager = client.artifact_manager
|
119
|
-
|
120
|
-
# Get all artifact templates
|
121
|
-
templates = artifact_manager.get_artifact_templates()
|
122
|
-
for template in templates:
|
123
|
-
if template.artifact_template_id == "qwen_2.5_14b_instruct_template_001":
|
124
|
-
# Create an artifact from a template
|
125
|
-
artifact_id = artifact_manager.create_artifact_from_template(
|
126
|
-
artifact_template_id=template.artifact_template_id,
|
127
|
-
)
|
128
|
-
|
129
|
-
return artifact_id
|
130
|
-
|
131
|
-
return ""
|
132
|
-
```
|
133
|
-
|
134
|
-
#### (b) Create a Task from the Artifact
|
135
|
-
|
136
|
-
Wait until the artifact becomes "ready" and then deploy it using task scheduling:
|
137
|
-
|
138
|
-
```python
|
139
|
-
from gmicloud import *
|
140
|
-
import time
|
141
|
-
from datetime import datetime
|
142
|
-
|
143
|
-
def create_task_and_start(client: Client, artifact_id: str) -> str:
|
144
|
-
artifact_manager = client.artifact_manager
|
145
|
-
# Wait for the artifact to be ready
|
146
|
-
while True:
|
147
|
-
try:
|
148
|
-
artifact = artifact_manager.get_artifact(artifact_id)
|
149
|
-
print(f"Artifact status: {artifact.build_status}")
|
150
|
-
# Wait until the artifact is ready
|
151
|
-
if artifact.build_status == BuildStatus.SUCCESS:
|
152
|
-
break
|
153
|
-
except Exception as e:
|
154
|
-
raise e
|
155
|
-
# Wait for 2 seconds
|
156
|
-
time.sleep(2)
|
157
|
-
try:
|
158
|
-
task_manager = client.task_manager
|
159
|
-
# Create a task
|
160
|
-
task = task_manager.create_task(Task(
|
161
|
-
config=TaskConfig(
|
162
|
-
ray_task_config=RayTaskConfig(
|
163
|
-
ray_version="2.40.0-py310-gpu",
|
164
|
-
file_path="serve",
|
165
|
-
artifact_id=artifact_id,
|
166
|
-
deployment_name="app",
|
167
|
-
replica_resource=ReplicaResource(
|
168
|
-
cpu=10,
|
169
|
-
ram_gb=100,
|
170
|
-
gpu=1,
|
171
|
-
),
|
172
|
-
),
|
173
|
-
task_scheduling=TaskScheduling(
|
174
|
-
scheduling_oneoff=OneOffScheduling(
|
175
|
-
trigger_timestamp=int(datetime.now().timestamp()) + 10,
|
176
|
-
min_replicas=1,
|
177
|
-
max_replicas=10,
|
178
|
-
)
|
179
|
-
),
|
180
|
-
),
|
181
|
-
))
|
182
|
-
|
183
|
-
# Start the task
|
184
|
-
task_manager.start_task(task.task_id)
|
185
|
-
except Exception as e:
|
186
|
-
raise e
|
187
|
-
|
188
|
-
return task.task_id
|
189
|
-
```
|
190
|
-
|
191
|
-
### (c) Query the Model Endpoint
|
192
|
-
|
193
|
-
Once the task is running, use the endpoint for inference:
|
194
|
-
|
195
|
-
```python
|
196
|
-
from gmicloud import *
|
197
|
-
from examples.completion import call_chat_completion
|
198
|
-
|
199
|
-
# Initialize the Client
|
200
|
-
cli = Client()
|
201
|
-
|
202
|
-
# Create an artifact from a template
|
203
|
-
artifact_id = create_artifact_from_template(cli)
|
204
|
-
|
205
|
-
# Create a task and start it
|
206
|
-
task_id = create_task_and_start(cli, artifact_id)
|
207
|
-
|
208
|
-
# Call chat completion
|
209
|
-
print(call_chat_completion(cli, task_id))
|
210
|
-
```
|
211
|
-
|
212
|
-
## API Reference
|
213
|
-
|
214
|
-
### Client
|
215
|
-
|
216
|
-
Represents the entry point to interact with GMI Cloud APIs.
|
217
|
-
Client(
|
218
|
-
client_id: Optional[str] = "",
|
219
|
-
email: Optional[str] = "",
|
220
|
-
password: Optional[str] = ""
|
221
|
-
)
|
222
|
-
|
223
|
-
### Artifact Management
|
224
|
-
|
225
|
-
* get_artifact_templates(): Fetch a list of available artifact templates.
|
226
|
-
* create_artifact_from_template(template_id: str): Create a model artifact from a given template.
|
227
|
-
* get_artifact(artifact_id: str): Get details of a specific artifact.
|
228
|
-
|
229
|
-
### Task Management
|
230
|
-
|
231
|
-
* create_task_from_artifact_template(template_id: str, scheduling: TaskScheduling): Create and schedule a task using an
|
232
|
-
artifact template.
|
233
|
-
* start_task(task_id: str): Start a task.
|
234
|
-
* get_task(task_id: str): Retrieve the status and details of a specific task.
|
235
|
-
|
236
|
-
## Notes & Troubleshooting
|
237
|
-
|
238
|
-
Ensure Credentials are Correct: Double-check your environment variables or parameters passed into the Client object.
|
239
|
-
Artifact Status: It may take a few minutes for an artifact or task to transition to the "running" state.
|
240
|
-
Inference Endpoint Readiness: Use the task endpoint only after the task status changes to "running".
|
241
|
-
Default OpenAI Key: By default, the OpenAI API base URL is derived from the endpoint provided by GMI.
|
242
|
-
|
243
|
-
## Contributing
|
244
|
-
|
245
|
-
We welcome contributions to enhance the SDK. Please follow these steps:
|
246
|
-
|
247
|
-
1. Fork the repository.
|
248
|
-
2. Create a new branch for your feature or bugfix.
|
249
|
-
3. Commit changes with clear messages.
|
250
|
-
4. Submit a pull request for review.
|
gmicloud-0.1.4.dist-info/RECORD
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
gmicloud/__init__.py,sha256=AJP9Z3Ba-AClp5P49YL32qH5-XzDTbEXhWZFF1iLP8Q,750
|
2
|
-
gmicloud/client.py,sha256=G3sgH7zzODhdW_Ad56xgomDWXKAhnjzZuj1_mEBGYCI,4733
|
3
|
-
gmicloud/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
gmicloud/_internal/_config.py,sha256=qIH76TSyS3MQWe62LHI46RJhDnklNFisdajY75oUAqE,218
|
5
|
-
gmicloud/_internal/_constants.py,sha256=Y085dwFlqdFkCf39iBfxz39QiiB7lX59ayNJjB86_m4,378
|
6
|
-
gmicloud/_internal/_enums.py,sha256=C4oy6Ps7OGdYd3tK-Wcpi6uXMyAKbOZW8_KykYAKsgw,510
|
7
|
-
gmicloud/_internal/_exceptions.py,sha256=hScBq7n2fOit4_umlkabZJchY8zVbWSRfWM2Y0rLCbw,306
|
8
|
-
gmicloud/_internal/_models.py,sha256=4YT1MI2V1YEBWBFEvrA6pRcmxkZCgi6rzTxYMRgfeWs,13880
|
9
|
-
gmicloud/_internal/_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
gmicloud/_internal/_client/_artifact_client.py,sha256=py6SQ1tVoK365hIIxnla433mpCapActZ6KE6Yakds-8,5588
|
11
|
-
gmicloud/_internal/_client/_decorator.py,sha256=sy4gxzsUB6ORXHw5pqmMf7TTlK41Nmu1fhIhK2AIsbY,670
|
12
|
-
gmicloud/_internal/_client/_file_upload_client.py,sha256=1JRs4X57S3EScPIP9w2DC1Uo6_Wbcjumcw3nVM7uIGM,4667
|
13
|
-
gmicloud/_internal/_client/_http_client.py,sha256=JZvw7HnCwyk6_5-Ja-KZuYY0JBJApx9I3jZ0G_J2kWw,5680
|
14
|
-
gmicloud/_internal/_client/_iam_client.py,sha256=xEDiwwpj1dAHmAOzcu9Jz7x1F3TRJLrCAqNXPQ-wyoU,4310
|
15
|
-
gmicloud/_internal/_client/_task_client.py,sha256=JgYewfDy2iblRVrc9sdA8RbcooXyAho79ESuCK8PRWI,3842
|
16
|
-
gmicloud/_internal/_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
gmicloud/_internal/_manager/_artifact_manager.py,sha256=cc367Kd-W9Zn2d_wUcG6tT06544HRItIZ5IsFfA5_RQ,12201
|
18
|
-
gmicloud/_internal/_manager/_task_manager.py,sha256=QQfpYXFKAAI_FSI--Nxvjlgf_jeVZuVnTuRGTQzrZso,8034
|
19
|
-
gmicloud/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
gmicloud/tests/test_artifacts.py,sha256=YiC1HBMS7g491Ra4acTLI9AdwyjXZfnY9f-fNKn2azQ,17108
|
21
|
-
gmicloud/tests/test_tasks.py,sha256=AY90zTJdsXk1cxn6Jxhi4TDdwXRiGxz_r_aRk_Jkl8Y,10956
|
22
|
-
gmicloud/utils/uninstall_packages.py,sha256=zzuuaJPf39oTXWZ_7tUAGseoxocuCbbkoglJSD5yDrE,1127
|
23
|
-
gmicloud-0.1.4.dist-info/METADATA,sha256=hwFbxM2blSJZQnRT-9x6y-ilfcgFL6_tdQP2f12TloQ,7689
|
24
|
-
gmicloud-0.1.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
25
|
-
gmicloud-0.1.4.dist-info/top_level.txt,sha256=AZimLw3y0WPpLiSiOidZ1gD0dxALh-jQNk4fxC05hYE,9
|
26
|
-
gmicloud-0.1.4.dist-info/RECORD,,
|
File without changes
|