proximl 0.5.0__tar.gz
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.
- proximl-0.5.0/LICENSE +21 -0
- proximl-0.5.0/PKG-INFO +239 -0
- proximl-0.5.0/README.md +224 -0
- proximl-0.5.0/examples/__init__.py +0 -0
- proximl-0.5.0/examples/create_dataset_and_training_job.py +46 -0
- proximl-0.5.0/examples/local_storage.py +65 -0
- proximl-0.5.0/examples/training_inference_pipeline.py +87 -0
- proximl-0.5.0/proximl/__init__.py +17 -0
- proximl-0.5.0/proximl/__main__.py +4 -0
- proximl-0.5.0/proximl/auth.py +644 -0
- proximl-0.5.0/proximl/checkpoints.py +258 -0
- proximl-0.5.0/proximl/cli/__init__.py +171 -0
- proximl-0.5.0/proximl/cli/checkpoint.py +265 -0
- proximl-0.5.0/proximl/cli/cloudbender/__init__.py +17 -0
- proximl-0.5.0/proximl/cli/cloudbender/datastore.py +160 -0
- proximl-0.5.0/proximl/cli/cloudbender/node.py +176 -0
- proximl-0.5.0/proximl/cli/cloudbender/provider.py +80 -0
- proximl-0.5.0/proximl/cli/cloudbender/region.py +121 -0
- proximl-0.5.0/proximl/cli/cloudbender/reservation.py +159 -0
- proximl-0.5.0/proximl/cli/connection.py +61 -0
- proximl-0.5.0/proximl/cli/dataset.py +263 -0
- proximl-0.5.0/proximl/cli/environment.py +42 -0
- proximl-0.5.0/proximl/cli/gpu.py +39 -0
- proximl-0.5.0/proximl/cli/job/__init__.py +245 -0
- proximl-0.5.0/proximl/cli/job/create.py +1361 -0
- proximl-0.5.0/proximl/cli/model.py +234 -0
- proximl-0.5.0/proximl/cli/project.py +154 -0
- proximl-0.5.0/proximl/cloudbender/__init__.py +3 -0
- proximl-0.5.0/proximl/cloudbender/cloudbender.py +17 -0
- proximl-0.5.0/proximl/cloudbender/datastores.py +120 -0
- proximl-0.5.0/proximl/cloudbender/device_configs.py +109 -0
- proximl-0.5.0/proximl/cloudbender/nodes.py +133 -0
- proximl-0.5.0/proximl/cloudbender/providers.py +63 -0
- proximl-0.5.0/proximl/cloudbender/regions.py +105 -0
- proximl-0.5.0/proximl/cloudbender/reservations.py +118 -0
- proximl-0.5.0/proximl/connections.py +621 -0
- proximl-0.5.0/proximl/datasets.py +236 -0
- proximl-0.5.0/proximl/environments.py +57 -0
- proximl-0.5.0/proximl/exceptions.py +140 -0
- proximl-0.5.0/proximl/gpu_types.py +66 -0
- proximl-0.5.0/proximl/jobs.py +548 -0
- proximl-0.5.0/proximl/models.py +229 -0
- proximl-0.5.0/proximl/projects.py +187 -0
- proximl-0.5.0/proximl/proximl.py +291 -0
- proximl-0.5.0/proximl.egg-info/PKG-INFO +239 -0
- proximl-0.5.0/proximl.egg-info/SOURCES.txt +97 -0
- proximl-0.5.0/proximl.egg-info/dependency_links.txt +1 -0
- proximl-0.5.0/proximl.egg-info/entry_points.txt +4 -0
- proximl-0.5.0/proximl.egg-info/requires.txt +6 -0
- proximl-0.5.0/proximl.egg-info/top_level.txt +3 -0
- proximl-0.5.0/pyproject.toml +30 -0
- proximl-0.5.0/setup.cfg +4 -0
- proximl-0.5.0/setup.py +44 -0
- proximl-0.5.0/tests/integration/__init__.py +0 -0
- proximl-0.5.0/tests/integration/cloudbender/__init__.py +0 -0
- proximl-0.5.0/tests/integration/cloudbender/test_providers_integration.py +46 -0
- proximl-0.5.0/tests/integration/conftest.py +46 -0
- proximl-0.5.0/tests/integration/test_checkpoints_integration.py +94 -0
- proximl-0.5.0/tests/integration/test_datasets_integration.py +103 -0
- proximl-0.5.0/tests/integration/test_environments_integration.py +54 -0
- proximl-0.5.0/tests/integration/test_gpu_types_integration.py +50 -0
- proximl-0.5.0/tests/integration/test_jobs_integration.py +682 -0
- proximl-0.5.0/tests/integration/test_models_integration.py +94 -0
- proximl-0.5.0/tests/integration/test_projects_integration.py +48 -0
- proximl-0.5.0/tests/unit/__init__.py +0 -0
- proximl-0.5.0/tests/unit/cli/__init__.py +0 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/__init__.py +0 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/test_cli_datastore_unit.py +38 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/test_cli_node_unit.py +38 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/test_cli_provider_unit.py +22 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/test_cli_region_unit.py +35 -0
- proximl-0.5.0/tests/unit/cli/cloudbender/test_cli_reservation_unit.py +38 -0
- proximl-0.5.0/tests/unit/cli/conftest.py +11 -0
- proximl-0.5.0/tests/unit/cli/test_cli_checkpoint_unit.py +22 -0
- proximl-0.5.0/tests/unit/cli/test_cli_datasets_unit.py +20 -0
- proximl-0.5.0/tests/unit/cli/test_cli_environment_unit.py +21 -0
- proximl-0.5.0/tests/unit/cli/test_cli_gpu_unit.py +20 -0
- proximl-0.5.0/tests/unit/cli/test_cli_job_unit.py +20 -0
- proximl-0.5.0/tests/unit/cli/test_cli_model_unit.py +20 -0
- proximl-0.5.0/tests/unit/cli/test_cli_project_unit.py +46 -0
- proximl-0.5.0/tests/unit/cloudbender/__init__.py +0 -0
- proximl-0.5.0/tests/unit/cloudbender/test_datastores_unit.py +153 -0
- proximl-0.5.0/tests/unit/cloudbender/test_device_configs_unit.py +152 -0
- proximl-0.5.0/tests/unit/cloudbender/test_nodes_unit.py +159 -0
- proximl-0.5.0/tests/unit/cloudbender/test_providers_unit.py +125 -0
- proximl-0.5.0/tests/unit/cloudbender/test_regions_unit.py +179 -0
- proximl-0.5.0/tests/unit/cloudbender/test_reservations_unit.py +153 -0
- proximl-0.5.0/tests/unit/conftest.py +913 -0
- proximl-0.5.0/tests/unit/test_auth.py +30 -0
- proximl-0.5.0/tests/unit/test_checkpoints_unit.py +462 -0
- proximl-0.5.0/tests/unit/test_connections_unit.py +182 -0
- proximl-0.5.0/tests/unit/test_datasets_unit.py +471 -0
- proximl-0.5.0/tests/unit/test_environments_unit.py +64 -0
- proximl-0.5.0/tests/unit/test_exceptions.py +31 -0
- proximl-0.5.0/tests/unit/test_gpu_types_unit.py +72 -0
- proximl-0.5.0/tests/unit/test_jobs_unit.py +830 -0
- proximl-0.5.0/tests/unit/test_models_unit.py +446 -0
- proximl-0.5.0/tests/unit/test_projects_unit.py +294 -0
- proximl-0.5.0/tests/unit/test_proximl.py +54 -0
proximl-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 proxiML, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
proximl-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: proximl
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: proxiML client SDK and command line utilities
|
|
5
|
+
Home-page: https://github.com/proxiML/python-sdk
|
|
6
|
+
Author: proxiML
|
|
7
|
+
Author-email: support@proximl.ai
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: <div align="center">
|
|
10
|
+
<a href="https://www.proximl.ai/"><img src="https://www.proximl.ai/static/img/proxiML-logo-purple.png"></a><br>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
# proxiML Python SDK and Command Line Tools
|
|
14
|
+
|
|
15
|
+
Provides programmatic access to [proxiML platform](https://app.proximl.ai).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Python 3.8 or above is required.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pip install proximl
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Authentication
|
|
26
|
+
|
|
27
|
+
### Prerequisites
|
|
28
|
+
|
|
29
|
+
You must have a valid [proxiML account](https://app.proximl.ai). On the [account settings page](https://app.proximl.ai/account/settings) click the `Create` button in the `API Keys` section. This will automatically download a `credentials.json` file. This file can only be generated once per API key. Treat this file as a password, as anyone with access to your API key will have the ability to create and control resources in your proxiML account. You can deactivate any API key by clicking the `Remove` button.
|
|
30
|
+
|
|
31
|
+
> Creating resources on the proxiML platform requires a non-zero credit balance. To purchase credits or sign-up for automatic credit top-ups, visit the [billing page](https://app.proximl.ai/account/billing).
|
|
32
|
+
|
|
33
|
+
### Methods
|
|
34
|
+
|
|
35
|
+
#### Credentials File
|
|
36
|
+
|
|
37
|
+
The easiest way to authenticate is to place the credentials file downloaded into the `.proximl` folder of your home directory and ensure only you have access to it. From the directory that the `credentials.json` file was downloaded, run the following command:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
mkdir -p ~/.proximl
|
|
41
|
+
mv credentials.json ~/.proximl/credentials.json
|
|
42
|
+
chmod 600 ~/.proximl/credentials.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Environment Variables
|
|
46
|
+
|
|
47
|
+
You can also use environment variables `PROXIML_USER` and `PROXIML_KEY` and set them to their respective values from the `credentials.json` file.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
export PROXIML_USER=<'user' field from credentials.json>
|
|
51
|
+
export PROXIML_KEY=<'key' field from credentials.json>
|
|
52
|
+
python create_job.py
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Environment variables will override any credentials stored in `~/.proximl/credentials.json`
|
|
56
|
+
|
|
57
|
+
#### Runtime Variables
|
|
58
|
+
|
|
59
|
+
API credentials can also be passed directly to the ProxiML object constructor at runtime.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
import proximl
|
|
63
|
+
proximl = proximl.ProxiML(user="user field from credentials.json",key="key field from credentials.json>")
|
|
64
|
+
await proximl.jobs.create(...)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Passing credentials to the ProxiML constructor will override all other methods for setting credentials.
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
By default, all operations using the proxiML SDK/CLI will use the Personal [project](https://docs.proximl.ai/reference/projects) for proxiML account the API keys were generated from. To change the active project, run the configure command:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
proximl configure
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This command will output the currently configured active project (`UNSET` defaults to `Personal`) and allows you to specify any project you have access to as the new active project.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Current Active Project: Personal
|
|
81
|
+
Select Active Project: (My Other Project, Personal, Project Shared With Me) [Personal]:
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Once you select a project, it will store the results of your selection in the `config.json` file in the `PROXIML_CONFIG_DIR` folder (`~/.proximl` by default). Once the active project is set, all subsequent operations will use the selected project.
|
|
85
|
+
|
|
86
|
+
This setting can also be overridden at runtime using the environment variable `PROXIML_PROJECT`:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
PROXIML_PROJECT=<PROJECT ID> python create_job.py
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
or by instantiating the proximl client with the `project` keyword argument:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
import proximl
|
|
96
|
+
proximl = proximl.ProxiML(project="PROJECT ID")
|
|
97
|
+
await proximl.jobs.create(...)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> You must specify the project ID (not name) when using the runtime options. The project ID can be found by running `proximl project list`.
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### Python SDK
|
|
105
|
+
|
|
106
|
+
The proxiML SDK utilizes the [asyncio library](https://docs.python.org/3/library/asyncio.html) to ease the concurrent execution of long running tasks. An example of how to create a dataset from an S3 bucket and immediately run a training job on that dataset is the following:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
from proximl.proximl import ProxiML
|
|
110
|
+
import asyncio
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
proximl_client = ProxiML()
|
|
114
|
+
|
|
115
|
+
# Create the dataset
|
|
116
|
+
dataset = asyncio.run(
|
|
117
|
+
proximl_client.datasets.create(
|
|
118
|
+
name="Example Dataset",
|
|
119
|
+
source_type="aws",
|
|
120
|
+
source_uri="s3://proximl-examples/data/cifar10",
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
print(dataset)
|
|
125
|
+
|
|
126
|
+
# Watch the log output, attach will return when data transfer is complete
|
|
127
|
+
asyncio.run(dataset.attach())
|
|
128
|
+
|
|
129
|
+
# Create the job
|
|
130
|
+
job = asyncio.run(
|
|
131
|
+
proximl_client.jobs.create(
|
|
132
|
+
name="Example Training Job",
|
|
133
|
+
type="training",
|
|
134
|
+
gpu_type="GTX 1060",
|
|
135
|
+
gpu_count=1,
|
|
136
|
+
disk_size=10,
|
|
137
|
+
workers=[
|
|
138
|
+
"PYTHONPATH=$PYTHONPATH:$PROXIML_MODEL_PATH python -m official.vision.image_classification.resnet_cifar_main --num_gpus=1 --data_dir=$PROXIML_DATA_PATH --model_dir=$PROXIML_OUTPUT_PATH --enable_checkpoint_and_export=True --train_epochs=10 --batch_size=1024",
|
|
139
|
+
],
|
|
140
|
+
data=dict(
|
|
141
|
+
datasets=[dict(id=dataset.id, type="existing")],
|
|
142
|
+
output_uri="s3://proximl-examples/output/resnet_cifar10",
|
|
143
|
+
output_type="aws",
|
|
144
|
+
),
|
|
145
|
+
model=dict(git_uri="git@github.com:proxiML/test-private.git"),
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
print(job)
|
|
149
|
+
|
|
150
|
+
# Watch the log output, attach will return when the training job stops
|
|
151
|
+
asyncio.run(job.attach())
|
|
152
|
+
|
|
153
|
+
# Cleanup job and dataset
|
|
154
|
+
asyncio.run(job.remove())
|
|
155
|
+
asyncio.run(dataset.remove())
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See more examples in the [examples folder](examples)
|
|
159
|
+
|
|
160
|
+
### Command Line Interface
|
|
161
|
+
|
|
162
|
+
The command line interface is rooted in the `proximl` command. To see the available options, run:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
proximl --help
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
To list all jobs:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
proximl job list
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
To list all datasets:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
proximl dataset list
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
To connect to a job that requires the [connection capability](https://docs.proximl.ai/reference/connection-capability):
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
proximl job connect <job ID or name>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
To watch the realtime job logs:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
proximl job attach <job ID or name>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
To create and open a notebook job:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
proximl job create notebook "My Notebook Job"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
To create a multi-GPU notebook job on a specific GPU type with larger scratch directory space:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
proximl job create notebook --gpu-type "RTX 3090" --gpu-count 4 --disk-size 50 "My Notebook Job"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
To run the model training code in the `train.py` file in your local `~/model-code` directory on the training data in your local `~/data` directory:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
proximl job create training --model-dir ~/model-code --data-dir ~/data "My Training Job" "python train.py"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Stop a job by job ID:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
proximl job stop fe52527c-1f4b-468f-b57d-86db864cc089
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Stop a job by name:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
proximl job stop "My Notebook Job"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Restart a notebook job:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
proximl job start "My Notebook Job"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Remove a job by job ID:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
proximl job remove fe52527c-1f4b-468f-b57d-86db864cc089
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Platform: UNKNOWN
|
|
235
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
236
|
+
Classifier: Programming Language :: Python :: 3
|
|
237
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
238
|
+
Requires-Python: >=3.8
|
|
239
|
+
Description-Content-Type: text/markdown
|
proximl-0.5.0/README.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://www.proximl.ai/"><img src="https://www.proximl.ai/static/img/proxiML-logo-purple.png"></a><br>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# proxiML Python SDK and Command Line Tools
|
|
6
|
+
|
|
7
|
+
Provides programmatic access to [proxiML platform](https://app.proximl.ai).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Python 3.8 or above is required.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pip install proximl
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Authentication
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
You must have a valid [proxiML account](https://app.proximl.ai). On the [account settings page](https://app.proximl.ai/account/settings) click the `Create` button in the `API Keys` section. This will automatically download a `credentials.json` file. This file can only be generated once per API key. Treat this file as a password, as anyone with access to your API key will have the ability to create and control resources in your proxiML account. You can deactivate any API key by clicking the `Remove` button.
|
|
22
|
+
|
|
23
|
+
> Creating resources on the proxiML platform requires a non-zero credit balance. To purchase credits or sign-up for automatic credit top-ups, visit the [billing page](https://app.proximl.ai/account/billing).
|
|
24
|
+
|
|
25
|
+
### Methods
|
|
26
|
+
|
|
27
|
+
#### Credentials File
|
|
28
|
+
|
|
29
|
+
The easiest way to authenticate is to place the credentials file downloaded into the `.proximl` folder of your home directory and ensure only you have access to it. From the directory that the `credentials.json` file was downloaded, run the following command:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
mkdir -p ~/.proximl
|
|
33
|
+
mv credentials.json ~/.proximl/credentials.json
|
|
34
|
+
chmod 600 ~/.proximl/credentials.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Environment Variables
|
|
38
|
+
|
|
39
|
+
You can also use environment variables `PROXIML_USER` and `PROXIML_KEY` and set them to their respective values from the `credentials.json` file.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
export PROXIML_USER=<'user' field from credentials.json>
|
|
43
|
+
export PROXIML_KEY=<'key' field from credentials.json>
|
|
44
|
+
python create_job.py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Environment variables will override any credentials stored in `~/.proximl/credentials.json`
|
|
48
|
+
|
|
49
|
+
#### Runtime Variables
|
|
50
|
+
|
|
51
|
+
API credentials can also be passed directly to the ProxiML object constructor at runtime.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
import proximl
|
|
55
|
+
proximl = proximl.ProxiML(user="user field from credentials.json",key="key field from credentials.json>")
|
|
56
|
+
await proximl.jobs.create(...)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Passing credentials to the ProxiML constructor will override all other methods for setting credentials.
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
By default, all operations using the proxiML SDK/CLI will use the Personal [project](https://docs.proximl.ai/reference/projects) for proxiML account the API keys were generated from. To change the active project, run the configure command:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
proximl configure
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This command will output the currently configured active project (`UNSET` defaults to `Personal`) and allows you to specify any project you have access to as the new active project.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Current Active Project: Personal
|
|
73
|
+
Select Active Project: (My Other Project, Personal, Project Shared With Me) [Personal]:
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Once you select a project, it will store the results of your selection in the `config.json` file in the `PROXIML_CONFIG_DIR` folder (`~/.proximl` by default). Once the active project is set, all subsequent operations will use the selected project.
|
|
77
|
+
|
|
78
|
+
This setting can also be overridden at runtime using the environment variable `PROXIML_PROJECT`:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
PROXIML_PROJECT=<PROJECT ID> python create_job.py
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
or by instantiating the proximl client with the `project` keyword argument:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
import proximl
|
|
88
|
+
proximl = proximl.ProxiML(project="PROJECT ID")
|
|
89
|
+
await proximl.jobs.create(...)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
> You must specify the project ID (not name) when using the runtime options. The project ID can be found by running `proximl project list`.
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
### Python SDK
|
|
97
|
+
|
|
98
|
+
The proxiML SDK utilizes the [asyncio library](https://docs.python.org/3/library/asyncio.html) to ease the concurrent execution of long running tasks. An example of how to create a dataset from an S3 bucket and immediately run a training job on that dataset is the following:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
from proximl.proximl import ProxiML
|
|
102
|
+
import asyncio
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
proximl_client = ProxiML()
|
|
106
|
+
|
|
107
|
+
# Create the dataset
|
|
108
|
+
dataset = asyncio.run(
|
|
109
|
+
proximl_client.datasets.create(
|
|
110
|
+
name="Example Dataset",
|
|
111
|
+
source_type="aws",
|
|
112
|
+
source_uri="s3://proximl-examples/data/cifar10",
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
print(dataset)
|
|
117
|
+
|
|
118
|
+
# Watch the log output, attach will return when data transfer is complete
|
|
119
|
+
asyncio.run(dataset.attach())
|
|
120
|
+
|
|
121
|
+
# Create the job
|
|
122
|
+
job = asyncio.run(
|
|
123
|
+
proximl_client.jobs.create(
|
|
124
|
+
name="Example Training Job",
|
|
125
|
+
type="training",
|
|
126
|
+
gpu_type="GTX 1060",
|
|
127
|
+
gpu_count=1,
|
|
128
|
+
disk_size=10,
|
|
129
|
+
workers=[
|
|
130
|
+
"PYTHONPATH=$PYTHONPATH:$PROXIML_MODEL_PATH python -m official.vision.image_classification.resnet_cifar_main --num_gpus=1 --data_dir=$PROXIML_DATA_PATH --model_dir=$PROXIML_OUTPUT_PATH --enable_checkpoint_and_export=True --train_epochs=10 --batch_size=1024",
|
|
131
|
+
],
|
|
132
|
+
data=dict(
|
|
133
|
+
datasets=[dict(id=dataset.id, type="existing")],
|
|
134
|
+
output_uri="s3://proximl-examples/output/resnet_cifar10",
|
|
135
|
+
output_type="aws",
|
|
136
|
+
),
|
|
137
|
+
model=dict(git_uri="git@github.com:proxiML/test-private.git"),
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
print(job)
|
|
141
|
+
|
|
142
|
+
# Watch the log output, attach will return when the training job stops
|
|
143
|
+
asyncio.run(job.attach())
|
|
144
|
+
|
|
145
|
+
# Cleanup job and dataset
|
|
146
|
+
asyncio.run(job.remove())
|
|
147
|
+
asyncio.run(dataset.remove())
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
See more examples in the [examples folder](examples)
|
|
151
|
+
|
|
152
|
+
### Command Line Interface
|
|
153
|
+
|
|
154
|
+
The command line interface is rooted in the `proximl` command. To see the available options, run:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
proximl --help
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
To list all jobs:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
proximl job list
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
To list all datasets:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
proximl dataset list
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
To connect to a job that requires the [connection capability](https://docs.proximl.ai/reference/connection-capability):
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
proximl job connect <job ID or name>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
To watch the realtime job logs:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
proximl job attach <job ID or name>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
To create and open a notebook job:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
proximl job create notebook "My Notebook Job"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
To create a multi-GPU notebook job on a specific GPU type with larger scratch directory space:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
proximl job create notebook --gpu-type "RTX 3090" --gpu-count 4 --disk-size 50 "My Notebook Job"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
To run the model training code in the `train.py` file in your local `~/model-code` directory on the training data in your local `~/data` directory:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
proximl job create training --model-dir ~/model-code --data-dir ~/data "My Training Job" "python train.py"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Stop a job by job ID:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
proximl job stop fe52527c-1f4b-468f-b57d-86db864cc089
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Stop a job by name:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
proximl job stop "My Notebook Job"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Restart a notebook job:
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
proximl job start "My Notebook Job"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Remove a job by job ID:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
proximl job remove fe52527c-1f4b-468f-b57d-86db864cc089
|
|
224
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from proximl.proximl import ProxiML
|
|
2
|
+
import asyncio
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
proximl_client = ProxiML()
|
|
6
|
+
|
|
7
|
+
# Create the dataset
|
|
8
|
+
dataset = asyncio.run(
|
|
9
|
+
proximl_client.datasets.create(
|
|
10
|
+
name="Example Dataset",
|
|
11
|
+
source_type="aws",
|
|
12
|
+
source_uri="s3://proximl-examples/data/cifar10",
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
print(dataset)
|
|
17
|
+
|
|
18
|
+
# Watch the log output, attach will return when data transfer is complete
|
|
19
|
+
asyncio.run(dataset.attach())
|
|
20
|
+
|
|
21
|
+
# Create the job
|
|
22
|
+
job = asyncio.run(
|
|
23
|
+
proximl_client.jobs.create(
|
|
24
|
+
name="Example Training Job",
|
|
25
|
+
type="training",
|
|
26
|
+
gpu_types=["rtx2080ti", "rtx3090"],
|
|
27
|
+
gpu_count=1,
|
|
28
|
+
disk_size=10,
|
|
29
|
+
workers=[
|
|
30
|
+
"python training/image-classification/resnet_cifar.py --epochs 10 --optimizer adam --batch-size 128",
|
|
31
|
+
],
|
|
32
|
+
data=dict(
|
|
33
|
+
datasets=[dataset.id],
|
|
34
|
+
output_uri="s3://proximl-examples/output/resnet_cifar10",
|
|
35
|
+
output_type="aws",
|
|
36
|
+
),
|
|
37
|
+
model=dict(
|
|
38
|
+
source_type="git",
|
|
39
|
+
source_uri="https://github.com/proxiML/examples.git",
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
print(job)
|
|
44
|
+
|
|
45
|
+
# Watch the log output, attach will return when the training job stops
|
|
46
|
+
asyncio.run(job.attach())
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from proximl.proximl import ProxiML
|
|
2
|
+
import asyncio
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
proximl_client = ProxiML()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def create_dataset():
|
|
9
|
+
# Create the dataset
|
|
10
|
+
dataset = await proximl_client.datasets.create(
|
|
11
|
+
name="Local Dataset",
|
|
12
|
+
source_type="local",
|
|
13
|
+
source_uri="~/tensorflow-example/data",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
print(dataset)
|
|
17
|
+
|
|
18
|
+
# Connect to the dataset and watch the logs
|
|
19
|
+
attach_task = asyncio.create_task(dataset.attach())
|
|
20
|
+
connect_task = asyncio.create_task(dataset.connect())
|
|
21
|
+
await asyncio.gather(attach_task, connect_task)
|
|
22
|
+
await dataset.disconnect()
|
|
23
|
+
return dataset
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
dataset = asyncio.run(create_dataset())
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
async def run_job(dataset):
|
|
30
|
+
# Create the job
|
|
31
|
+
|
|
32
|
+
job = await proximl_client.jobs.create(
|
|
33
|
+
name="Training Job with Local Output",
|
|
34
|
+
type="training",
|
|
35
|
+
gpu_types=["rtx2080ti", "rtx3090"],
|
|
36
|
+
gpu_count=1,
|
|
37
|
+
disk_size=10,
|
|
38
|
+
workers=[
|
|
39
|
+
"python training/image-classification/resnet_cifar.py --epochs 10 --optimizer adam --batch-size 128",
|
|
40
|
+
],
|
|
41
|
+
data=dict(
|
|
42
|
+
datasets=[dataset.id],
|
|
43
|
+
output_uri="~/tensorflow-example/output",
|
|
44
|
+
output_type="local",
|
|
45
|
+
),
|
|
46
|
+
model=dict(source_type="local", source_uri="~/proximl-examples"),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
print(job)
|
|
50
|
+
|
|
51
|
+
# Jobs using Local Model will wait for you to connect in the "waiting for data/model download" state
|
|
52
|
+
await job.wait_for("waiting for data/model download")
|
|
53
|
+
attach_task = asyncio.create_task(job.attach())
|
|
54
|
+
connect_task = asyncio.create_task(job.connect())
|
|
55
|
+
await asyncio.gather(attach_task, connect_task)
|
|
56
|
+
|
|
57
|
+
# Cleanup job
|
|
58
|
+
await job.disconnect()
|
|
59
|
+
await job.remove()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
asyncio.run(run_job(dataset))
|
|
63
|
+
|
|
64
|
+
# Cleanup Dataset
|
|
65
|
+
asyncio.run(dataset.remove())
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from proximl.proximl import ProxiML
|
|
2
|
+
import asyncio
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
proximl_client = ProxiML()
|
|
6
|
+
|
|
7
|
+
# Create the dataset
|
|
8
|
+
dataset = asyncio.run(
|
|
9
|
+
proximl_client.datasets.create(
|
|
10
|
+
name="Example Dataset",
|
|
11
|
+
source_type="aws",
|
|
12
|
+
source_uri="s3://proximl-examples/data/cifar10",
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
print(dataset)
|
|
17
|
+
|
|
18
|
+
# Watch the log output, attach will return when data transfer is complete
|
|
19
|
+
asyncio.run(dataset.attach())
|
|
20
|
+
|
|
21
|
+
# Create the job
|
|
22
|
+
training_job = asyncio.run(
|
|
23
|
+
proximl_client.jobs.create(
|
|
24
|
+
name="Example Training Job",
|
|
25
|
+
type="training",
|
|
26
|
+
gpu_types=["rtx2080ti", "rtx3090"],
|
|
27
|
+
gpu_count=1,
|
|
28
|
+
disk_size=10,
|
|
29
|
+
workers=[
|
|
30
|
+
"python training/image-classification/resnet_cifar.py --epochs 10 --optimizer adam --batch-size 128",
|
|
31
|
+
],
|
|
32
|
+
data=dict(
|
|
33
|
+
datasets=[dataset.id], output_type="proximl", output_uri="model"
|
|
34
|
+
),
|
|
35
|
+
model=dict(
|
|
36
|
+
source_type="git",
|
|
37
|
+
source_uri="https://github.com/proxiML/examples.git",
|
|
38
|
+
),
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
print(training_job)
|
|
42
|
+
|
|
43
|
+
# Watch the log output, attach will return when the training job stops
|
|
44
|
+
asyncio.run(training_job.attach())
|
|
45
|
+
|
|
46
|
+
# Get the trained model id from the workers
|
|
47
|
+
training_job = asyncio.run(training_job.refresh())
|
|
48
|
+
|
|
49
|
+
model = asyncio.run(
|
|
50
|
+
proximl_client.models.get(training_job.workers[0].get("output_uuid"))
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Ensure the model is ready to use
|
|
54
|
+
asyncio.run(model.wait_for("ready"))
|
|
55
|
+
|
|
56
|
+
# Use the model in an inference job on new data
|
|
57
|
+
inference_job = asyncio.run(
|
|
58
|
+
proximl_client.jobs.create(
|
|
59
|
+
name="Example Inference Job",
|
|
60
|
+
type="inference",
|
|
61
|
+
gpu_types=["rtx2080ti", "rtx3090"],
|
|
62
|
+
gpu_count=1,
|
|
63
|
+
disk_size=10,
|
|
64
|
+
workers=[
|
|
65
|
+
"python training/image-classification/resnet_cifar.py",
|
|
66
|
+
],
|
|
67
|
+
data=dict(
|
|
68
|
+
input_type="aws",
|
|
69
|
+
input_uri="s3://proximl-examples/data/new_data",
|
|
70
|
+
output_type="aws",
|
|
71
|
+
output_uri="s3://proximl-examples/output/model_predictions",
|
|
72
|
+
),
|
|
73
|
+
model=dict(source_type="proximl", source_uri=model.id),
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
print(inference_job)
|
|
77
|
+
|
|
78
|
+
# Watch the log output, attach will return when the training job stops
|
|
79
|
+
asyncio.run(inference_job.attach())
|
|
80
|
+
|
|
81
|
+
# (Optional) Cleanup
|
|
82
|
+
asyncio.gather(
|
|
83
|
+
training_job.remove(),
|
|
84
|
+
inference_job.remove(),
|
|
85
|
+
model.remove(),
|
|
86
|
+
dataset.remove(),
|
|
87
|
+
)
|