Uploading a custom asset to the OctoAI Asset Library

You can customize images using either OctoAI assets or custom assets from the OctoAI Asset Library

OctoAI empowers you to customize images by leveraging assets like checkpoints, LoRAs, and textual inversions. You can either use:

  • Public assets in the OctoAI Asset Library
  • Upload your custom asset to the OctoAI Asset Library (private by default, and optionally public)
  • Or use OctoAI fine-tuning to create new assets - see Fine-tuning Stable Diffusion

This tutorial explains how to upload your own private assets to the Asset Library.

  1. First download the OctoAI CLI by following the instructions in CLI & SDK Installation Check that it is properly installed by running the following in your terminal:
$ octoai asset --help
Manage OctoAI assets

Usage:
  octoai asset [command]

Available Commands:
  create      Create asset
  delete      Delete an asset
  get         Get asset
  list        List assets

Flags:
  -h, --help   help for asset

Global Flags:
      --log-level string   Set log level: fatal, error, warning, info, debug, trace (default "info")

Use "octoai asset [command] --help" for more information about a command.
  1. Run octoai login to cache your token and authenticate to your account.
  2. We can now use the octoai asset create subcommand to upload assets (you can run octoai asset create --help to learn more on the options).
    1. The --engine denotes whether this is an asset for SDXL or SD1.5
    2. The --upload-from-file flag denotes the path of the file on your local machine that you’re trying to upload.
    3. The —type can be lora, checkpoint, or textual_inversion (VAEs coming soon)
    4. --format denotes the format of your asset, which can be safetensors or pt.
    5. --datatype can be fp16, fp32, int4, or int8. For image gen, it should almost always be fp16, but for LLMs and other modalities your asset may have other datatypes.
    6. The --name is a name for your asset. You can only use each asset name once.
    7. --transfer-api defaults to sts which is the fastest way to upload a large asset.
    8. If you are uploading a textual inversion, make sure to use the -w flag to denote the default trigger word for the asset. That trigger word can later be used at generation time to activate the inversion. For LoRAs, trigger words are optional.

So for example, if you want to upload a Textual Inversion file from your local machine, you can call a command like:

octoai asset create --engine image/stable-diffusion-xl-v1-0 --upload-from-file negativeXL_D.safetensors --name NegativeXL --format safetensors --data-type fp16 --type textual_inversion --description "NegativeXL Textual Inversion" --public false -w “negativeXL_D”
  1. You can then use this Textual Inversion at image generation time while benefiting from OctoAI’s lightning fast asset load and e2e inference speed, for example with a payload to [image.octoai.run/generate/{engine_id}](http://image.octoai.run/generate/{engine_id}) with the following in your payload

    payload = {
        ...
        "textual_inversions": {
            "NegativeXL": "negativeXL_D",
        },
    }
    ...