Automate your AI pipeline
Using Jarvislabs.ai API, you can automate your AI training/deployment pipeline.
Steps to get started
- Install JLclient
- Generate API token
- Authentication
- Create Instance object which helps with.
- Launch GPU/CPU powered instance
- Pause
- Resume
- Destroy
- Use User class to
- get instances which are in running and paused state.
- create an
Instance
object of a created instance. - add scripts
- delete scripts
- update scripts
JLclient is currently in beta. Find something missing or need support reach us via chat or drop an email to hello@jarvislabs.ai
Install JLclient
pip install git+https://github.com/jarvislabsai/jlclient.git
Generate API token
Generate API token here .
Authentication
Once you have generated the API token, you can add the token along with your user_id in a python
file where you can manage the instance lifecycle.
from jlclient import jarvisclient
from jlclient.jarvisclient import *
jarvisclient.token = '**************************duWRbO68IiMTkQKWi48'
jarvisclient.user_id = '****************@gmail.com'
Keep the token secure, if lost you can generate a new one.
Instance
An Instance object helps in managing the lifecycle of an instance.
Create a GPU/CPU powered instance.
We can use Instance.create
to launch an instance.
instance = Instance.create(gpu_type='A100',
num_gpus=1,
hdd=20,
framework_id=0,
name='IamAI',
script_id=1)
It accepts the below parameters.
Parameter name | Type | Description/Values | Default value |
---|---|---|---|
gpu_type | str | Range of Nvidia GPU cards like - RTX5000 , RTX6000 , A100 , A6000 and A5000 . Defaults to 'RTX5000'. You can also choose CPU. | RTX5000 |
num_gpus | int | Number of GPU's while creating instance min (1) to max (8). For CPU instance : num_gpus=1 | 1 |
hdd | int | Persistance storage volume size ranges from 20GB to 500GB in multiples of 10. | 20 |
framework_id | int | Optimized NGC container with various deeplearning framework like {Pytorch : 0, Fastai : 1, Tensorflow-2 : 2, BYOC : 3}. | 0 |
name | str | Name the instance which is meaningful to differentiate with other instance | Name me |
script_id | str | Name the script to understand what kind of function it does. | None |
image | str | Name of the docker image like pytorch/pytorch . Applies only for the BYOC mode. Please select the framework_id=3. | None |
arguments | str | Pass a space delimited value, that will be passed to a shell script. No splecial characters are allowed. Example: resnet18 100 | None |
is_reserved | bool | True for reserved, and False for Spot instances | True |
duration | str | Choose hour, week, and month. The pricing changes based on the duration. | hour |
The instance object has the below attributes.
Attribute name | Description |
---|---|
url | Contains the url of Jupyter lab |
tboard_url | Contains tensorboard url |
machine_id | Unique value to identify machine |
ssh_str | SSH command to connect to the remote instance |
name | The name of the instance you provided. |
status | Status of the instance - Running or Paused |
is_reserved | True if reserved else False |
You can also use the instance object to pause, resume and destroy.
Method | Parameters | Description |
---|---|---|
pause | None | Pauses the instance. Example: instance.pause() |
resume | num_gpus, gpu_type, hdd | You can just call instance.resume() or change the number of gpus, gpu type and storage size. All these parameters are optional. |
destroy | None | Destroy/Delete the instance. Example: instance.destroy() |
You can also use User.get_instance
to get an Instance
object.
instance = User.get_instance(34063)
instance.resume()
Pause
instance.pause()
You can call pause()
on any Instance
object.
Resume
#Example 1:
instance.resume()
#Example 2:
instance.resume(num_gpus=1,
gpu_type='RTX5000',
hdd=100)
Destroy
instance.destroy()
User management.
The User
class comes with the below key functionalities.
Method | Description |
---|---|
User.get_instances(status=None) | Returns a list of Instance objects representing instances in your account. |
User.get_instance(instance_id) | Returns an object of Instance , on which pause, resume, and destroy can be called. |
User.add_script() | You can add upto 3 scripts. It returns a script_id which you can use while creating an instance. The script is automatically run during instance startup. |
User.delete_script() | Delete any unused script. |
User.get_script() | List all the scripts associated with your user account. |
List all the instances
You can list all the instances using User.get_instances(status=None)
Example
# Lists instances that are in Running, Paused, Resuming and Pausing states.
User.get_instances()
# List instances that are in running state
User.get_instances(status='running')
# List instances that are in paused state
User.get_instances(status='paused')
Example for adding script
User.add_script(script_path='install_fastai.sh',
script_name='myscript')
Do you like to see any new features, we are all ears. You can drop us an email to hello@jarvislabs.ai or chat with us for any new features or issues.