Skip to main content

Automate your AI pipeline

Using Jarvislabs.ai API, you can automate your AI training/deployment pipeline.

Steps to get started

  1. Install JLclient
  2. Generate API token
  3. Authentication
  4. Create Instance object which helps with.
    • Launch GPU/CPU powered instance
    • Pause
    • Resume
    • Destroy
  5. 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
info

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'

warning

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 nameTypeDescription/ValuesDefault value
gpu_typestrRange of Nvidia GPU cards like - RTX5000, RTX6000, A100, A6000 and A5000. Defaults to 'RTX5000'. You can also choose CPU.RTX5000
num_gpusintNumber of GPU's while creating instance min (1) to max (8). For CPU instance : num_gpus=11
hddintPersistance storage volume size ranges from 20GB to 500GB in multiples of 10.20
framework_idintOptimized NGC container with various deeplearning framework like {Pytorch : 0, Fastai : 1, Tensorflow-2: 2, BYOC : 3}.0
namestrName the instance which is meaningful to differentiate with other instanceName me
script_idstrName the script to understand what kind of function it does.None
imagestrName of the docker image like pytorch/pytorch. Applies only for the BYOC mode. Please select the framework_id=3.None
argumentsstrPass a space delimited value, that will be passed to a shell script. No splecial characters are allowed. Example: resnet18 100None
is_reservedboolTrue for reserved, and False for Spot instancesTrue
durationstrChoose hour, week, and month. The pricing changes based on the duration.hour

The instance object has the below attributes.

Attribute nameDescription
urlContains the url of Jupyter lab
tboard_urlContains tensorboard url
machine_idUnique value to identify machine
ssh_strSSH command to connect to the remote instance
nameThe name of the instance you provided.
statusStatus of the instance - Running or Paused
is_reservedTrue if reserved else False

You can also use the instance object to pause, resume and destroy.

MethodParametersDescription
pauseNonePauses the instance. Example: instance.pause()
resumenum_gpus, gpu_type, hddYou can just call instance.resume() or change the number of gpus, gpu type and storage size. All these parameters are optional.
destroyNoneDestroy/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.

MethodDescription
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')
info

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.