Skip to content

type field value for uploading the model in trainml_client.jobs.create #2

@TejaswiniiB

Description

@TejaswiniiB

Hi,
I am trying to first upload the model and code, and then run inference job.
For uploading the model from my local system, I am following this blog: https://docs.trainml.ai/blog/2021/06/28/local-model-integration/#using-the-sdk

I just want to upload the model first, but not to run a training job. In that case, what should I put the type field value?

Below is the code snippet I'm using for uploading the model. When I run below code, I'm getting an error which I pasted below the code. Is anything else not correct in the below code which is resulting in the error?

async def run_model_upload_job():
    job = await trainml_client.jobs.create( 
                            name="Personalization_video_model_trial_v1",
                            model=dict(source_type="local", source_uri="/home/tejaswini/Documents/Product_v1"),
                            type="model_load",
                            gpu_type="GTX 1060",
                            gpu_count=1,
                            disk_size=10
                            )
    print(job)

    await job.wait_for("waiting for model upload")
    attach_task = asyncio.create_task(job.attach())
    connect_task = asyncio.create_task(job.connect())
    await asyncio.gather(attach_task, connect_task)


    # Cleanup job
    await job.disconnect()
    await job.remove()
{'message': 'Invalid request body'}
Traceback (most recent call last):
  File "load_model.py", line 66, in <module>
    asyncio.run(run_model_upload_job())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "load_model.py", line 17, in run_model_upload_job
    job = await trainml_client.jobs.create( 
  File "/home/tejaswini/Documents/serverless_gpu_trial/trainml_ai/.venv/lib/python3.8/site-packages/trainml/jobs.py", line 115, in create
    job = await self.create_json(payload)
  File "/home/tejaswini/Documents/serverless_gpu_trial/trainml_ai/.venv/lib/python3.8/site-packages/trainml/jobs.py", line 121, in create_json
    resp = await self.trainml._query("/job", "POST", None, payload)
  File "/home/tejaswini/Documents/serverless_gpu_trial/trainml_ai/.venv/lib/python3.8/site-packages/trainml/trainml.py", line 129, in _query
    raise ApiError(
trainml.exceptions.ApiError: ApiError(400, 'Invalid request body')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions