Create Model

Model in Instill Core is a deployable resource that functions as an API service. It is defined by a declarative configuration file, along with the model implementation, which is containerized and built into an image. This image is then pushed to Instill Core for persistent hosting and serving.

Model offers multiple methods for creating a model, including HTTP and gRPC APIs, the Python and TypeScript SDKs, and the Console.

Create Model via API

curl -X POST 'http://localhost:8080/v1alpha/namespaces/{NAMESPACE_ID}/models' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Basic {INSTILL_API_TOKEN}' \
	--data '{
	"id": "{MODEL_ID}",
	"task": "TASK_CUSTOM",
	"modelDefinition": "model-definitions/container",
	"visibility": "VISIBILITY_PRIVATE",
	"region": "REGION_LOCAL",
	"hardware": "CPU",
	"configuration": {}
	}'
from instill.clients import init_model_client

model = init_model_client(api_token="{INSTILL_API_TOKEN}", url="http://localhost:8080")
model.create_model(
  namespace_id="{NAMESPACE_ID}",
  model_id="{MODEL_ID}",
  task="TASK_CUSTOM",
  region="REGION_LOCAL",
  hardware="CPU",
  is_public=False,
)
model.close()

NAMESPACE_ID refers to the user or organization ID, and MODEL_ID is the model ID. The resource ID must start with a lowercase letter (a–z) or an underscore, followed by up to 31 characters that may include lowercase letters (a–z), digits (0–9), hyphens, or underscores. The total length must be between 1 and 32 characters.

INSTILL_API_TOKEN is the API token that should be created in advance.

Create Model via Console

To create a new model from the Console, follow these steps:

  1. Launch Console via a local Instill Core CE deployment at http://localhost:3000, or by selecting the Go to Console button in the bottom-left of the Instill Agent interface if you are using managed Instill Core.
  2. Navigate to the Models page using the navigation bar.
  3. Click the + Create Model button.
  4. Select the Owner, i.e., the namespace.
  5. Enter the Model ID for your model.
  6. (Optional) Enter a description for your model.
  7. Select the AI Task for your model.
  8. Select the Hardware for your model.
  9. Click the Create Model button.