Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simplismart.ai/llms.txt

Use this file to discover all available pages before exploring further.

For custom models or custom pipelines, you must prepare the model configuration before adding the model to the platform. This includes defining the model logic, dependencies, and runtime environment. The platform expects all required files to be packaged together and provided as a single artifact (a ZIP file). This page describes how to implement the model interface, define runtime configuration, package your model, and add it through the Simplismart platform.

Model interface (model.py)

Your custom model must implement a standard interface so the platform can load and run it correctly. Method requirements:
  • load(): Handles model initialization and weight loading
  • preprocess(): Optional input preprocessing
  • predict(): Core inference logic
  • postprocess(): Optional output formatting
Example:
class Model:
    def __init__(self):
        self.model = None

    def load(self):
        # Initialize or load model weights
        self.model = "Model Initialization"

    def preprocess(self, request):
        """
        Preprocess the incoming request.
        Input can be a Pydantic BaseModel, dict, or string.
        """
        return request

    def predict(self, request):
        # Run inference
        output = self.model.predict()
        return output

    def postprocess(self, request):
        # Postprocess the model output
        return request

Runtime configuration (config.yaml)

The config.yaml file defines the execution environment for the custom model.
SectionPurpose
python_versionPython runtime version
environment_variablesCustom environment variables (if any)
requirementsPython dependencies
system_packagesOS-level packages
custom_setup_scriptOptional setup script executed during build
Example:
python_version: "3.10"

environment_variables: {}

requirements:
  - accelerate==0.20.3
  - bitsandbytes==0.39.1
  - peft==0.3.0
  - protobuf==4.23.3
  - sentencepiece==0.1.99
  - torch==2.0.1
  - transformers==4.30.2

system_packages:
  - wget
  - curl

custom_setup_script: "script.sh"

Packaging the custom model

Before adding the model to the platform, package all required files into a single ZIP file.
1

Create a single directory

Place the following in one folder:
  • model.py
  • config.yaml
  • Any additional scripts or assets (e.g. script.sh)
2

Compress the directory

Create a ZIP file containing the directory contents.
3

Upload the ZIP

Upload the ZIP to one of the supported model sources:
  • AWS S3
  • GCP GCS
  • Public URL
Upload your trained model to AWS S3 or GCP GCS, share the access credentials, and the platform will compile and prepare it for deployment. Models built to your specifications are integrated into the platform.

Adding the custom model to the platform

In the UI, point the platform to your ZIP, choose Custom Pipeline as the model type, and add the model. The platform then unpacks the archive and loads your model. On the Simplismart platform, provide your ZIP file, choose Custom Pipeline as the model type, and add the model. The platform then unpacks the archive and loads your model.
1

Open Add Model

Go to My Models and click Add a Model (top-right).My models
2

Enter model details

  • Model name: A name for your model.
  • Model source: Hugging Face, AWS S3, GCP GCS, or Public URL (use the source where you uploaded the ZIP).
  • Model path: Path to the ZIP file (e.g. S3 URI, GCS URI, or public URL).
  • If using AWS or GCP, select the linked Cloud credentials. Add model details form
3

Set model class

Under Model Class, choose Custom Pipeline (or Custom Model).
4

Select infrastructure

Choose Simplismart Cloud or Bring Your Own Cloud. Select Accelerator type and machine type based on your model size and compute requirements.
5

Pipeline configuration (Optional)

Use the Pipeline Config Editor or Extra Params to tune deployment. For custom models, set type to "custom". See the table and example below.
6

Add the model

Click Add Model to start compilation. The platform unpacks the archive, sets up the environment, and loads the model.

Extra parameters (optional)

Based on your model pipeline, you can add extra parameters in JSON format under Extra Params.
FieldTypeDefaultDescription
workers_per_deviceInt1Parallel workers per device (higher can improve inference speed).
devicestringcpu"cpu" or "cuda".
endpointstring/predictURL path for inference requests.
typestring(required)Use "custom" for custom models; other values: "whisper", "llm", "sd".
For custom models, set type to "custom" in the pipeline configuration.
Example:
{
  "type": "custom",
  "extra_params": {
    "workers_per_device": 2,
    "device": "cuda",
    "endpoint": "/predict"
  }
}

Next steps

Once the model is compiled, see Deploy a custom model to deploy your custom model.