Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/cli/Guides/Solutions/tgwui.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/cli/Guides/collaboration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: "collaboration"
title: "Confidential Collaboration"
title: "Two-party Collaboration"
slug: "/guides/collaboration"
displayed_sidebar: null
unlisted: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
id: "comfyui"
title: "ComfyUI"
title: "Custom ComfyUI Workflow"
slug: "/guides/solutions/comfyui"
sidebar_position: 2
sidebar_position: 4
---

import Tabs from '@theme/Tabs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: "fine-tune"
title: "Confidential Collaboration"
slug: "/guides/fine-tune"
sidebar_position: 3
title: "Multi-Party Collaboration"
slug: "/guides/multi-party-collab"
sidebar_position: 7
---

Super Protocol enables independent parties to jointly compute over their private inputs without revealing those inputs to one another.

This guide describes a scenario of confidential collaboration on Super Protocol. It uses fine-tuning of a pre-trained AI model as an example, but the general principle presented here may be applied to other cases.
This guide describes a scenario of a multi-party confidential collaboration on Super Protocol. It uses fine-tuning of a pre-trained AI model as an example, but the general principle presented here may be applied to other cases.

The scenario involves three parties:

Expand Down Expand Up @@ -41,11 +41,11 @@ sequenceDiagram
```
<br/>

Carol builds a <a id="solution"><span className="dashed-underline">solution</span></a>—a Docker image containing her training engine and script ([1](/cli/guides/fine-tune#carol-1-build-a-solution)). She uploads the solution using SPCTL ([2](/cli/guides/fine-tune#carol-2-upload-the-solution)) and grants Alice and Bob access for verification ([3](/cli/guides/fine-tune#carol-3-send-the-solution-to-alice-and-bob)).
Carol builds a <a id="solution"><span className="dashed-underline">solution</span></a>—a Docker image containing her training engine and script ([1](/cli/guides/multi-party-collab#carol-1-build-a-solution)). She uploads the solution using SPCTL ([2](/cli/guides/multi-party-collab#carol-2-upload-the-solution)) and grants Alice and Bob access for verification ([3](/cli/guides/multi-party-collab#carol-3-send-the-solution-to-alice-and-bob)).

Alice and Bob download the solution ([4](/cli/guides/fine-tune#alice-and-bob-4-download-the-solution)) and verify that it is safe to process their <a id="data"><span className="dashed-underline">data</span></a> ([5](/cli/guides/fine-tune#alice-and-bob-5-verify-the-solution)).
Alice and Bob download the solution ([4](/cli/guides/multi-party-collab#alice-and-bob-4-download-the-solution)) and verify that it is safe to process their <a id="data"><span className="dashed-underline">data</span></a> ([5](/cli/guides/multi-party-collab#alice-and-bob-5-verify-the-solution)).

If Carol cannot share the code with Alice and Bob, and a third-party auditor is involved, the workflow will differ slightly. After uploading, Carol must also create a solution <a id="offer"><span className="dashed-underline">offer</span></a> on Super Protocol Marketplace (similar to Bob's [Step 8](/cli/guides/fine-tune#bob-8-create-an-offer)).
If Carol cannot share the code with Alice and Bob, and a third-party auditor is involved, the workflow will differ slightly. After uploading, Carol must also create a solution <a id="offer"><span className="dashed-underline">offer</span></a> on Super Protocol Marketplace (similar to Bob's [Step 8](/cli/guides/multi-party-collab#bob-8-create-an-offer)).

**Prepare the data**:

Expand All @@ -64,9 +64,9 @@ sequenceDiagram
```
<br/>

Alice uploads her model ([6](/cli/guides/fine-tune#alice-6-upload-the-model)) and Bob uploads his dataset ([7](/cli/guides/fine-tune#bob-7-upload-the-dataset)) to remote storage using SPCTL. Files are automatically encrypted during upload, and only the uploader holds the key.
Alice uploads her model ([6](/cli/guides/multi-party-collab#alice-6-upload-the-model)) and Bob uploads his dataset ([7](/cli/guides/multi-party-collab#bob-7-upload-the-dataset)) to remote storage using SPCTL. Files are automatically encrypted during upload, and only the uploader holds the key.

Bob creates an offer on the Marketplace ([8](/cli/guides/fine-tune#bob-8-create-an-offer)). The offer requires Bob's manual approval for use. He shares the offer's IDs with Alice.
Bob creates an offer on the Marketplace ([8](/cli/guides/multi-party-collab#bob-8-create-an-offer)). The offer requires Bob's manual approval for use. He shares the offer's IDs with Alice.

**Execute**:

Expand All @@ -92,13 +92,13 @@ sequenceDiagram
```
<br/>

Alice places an <a id="order"><span className="dashed-underline">order</span></a> on Super Protocol ([9](/cli/guides/fine-tune#alice-9-place-an-order)), adding the solution, her model, and Bob's offer. The order does not proceed automatically and remains `Blocked`.
Alice places an <a id="order"><span className="dashed-underline">order</span></a> on Super Protocol ([9](/cli/guides/multi-party-collab#alice-9-place-an-order)), adding the solution, her model, and Bob's offer. The order does not proceed automatically and remains `Blocked`.

Bob manually approves the usage of his dataset for the image with a specific hash ([10](/cli/guides/fine-tune#bob-10-complete-the-data-suborder)). If this hash matches the actual solution hash, the <a id="cvm"><span className="dashed-underline">CVM</span></a> begins to process the order. If the hashes do not match, the order will be terminated with an error.
Bob manually approves the usage of his dataset for the image with a specific hash ([10](/cli/guides/multi-party-collab#bob-10-complete-the-data-suborder)). If this hash matches the actual solution hash, the <a id="cvm"><span className="dashed-underline">CVM</span></a> begins to process the order. If the hashes do not match, the order will be terminated with an error.

When the order is complete, Alice downloads the result ([11](/cli/guides/fine-tune#alice-11-download-the-order-results)). All the data within the TEE (solution, AI model, dataset, order results, etc.) is automatically deleted.
When the order is complete, Alice downloads the result ([11](/cli/guides/multi-party-collab#alice-11-download-the-order-results)). All the data within the TEE (solution, AI model, dataset, order results, etc.) is automatically deleted.

Both Alice and Bob can retrieve the order report ([12](/cli/guides/fine-tune#alice-and-bob-12-get-the-order-report)) that confirms the authenticity of the entire trusted setup.
Both Alice and Bob can retrieve the order report ([12](/cli/guides/multi-party-collab#alice-and-bob-12-get-the-order-report)) that confirms the authenticity of the entire trusted setup.

## Prerequisites

Expand Down Expand Up @@ -138,7 +138,7 @@ Always use absolute paths, such as `/sp/...`.

:::

You may either include the training scripts in the image or upload them separately using SPCTL. In this case, Alice will need to attach the uploaded scripts to the order as `--data` at [Step 9](/cli/guides/fine-tune#alice-9-place-an-order).
You may either include the training scripts in the image or upload them separately using SPCTL. In this case, Alice will need to attach the uploaded scripts to the order as `--data` at [Step 9](/cli/guides/multi-party-collab#alice-9-place-an-order).

You can find several Dockerfile examples in the [Super-Protocol/solutions](https://github.com/Super-Protocol/solutions) GitHub repository.

Expand Down
2 changes: 1 addition & 1 deletion docs/cli/Guides/provider-tools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: "provider-tools"
title: "Configure Provider Tools"
title: "Provider Tools"
slug: "/guides/provider-tools"
sidebar_position: 1
---
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/Guides/quick-guide.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
id: "quick-guide"
title: "Quick Deployment Guide"
title: "Deploy Your App"
slug: "/guides/quick-guide"
sidebar_position: 2
---

This quick guide provides instructions on deploying a <a id="solution"><span className="dashed-underline">solution</span></a> and <a id="data"><span className="dashed-underline">data</span></a> on Super Protocol. Its purpose is to introduce you to the logic and sequence of the CLI commands.
This quick guide provides instructions on deploying your own <a id="solution"><span className="dashed-underline">solution</span></a> and <a id="data"><span className="dashed-underline">data</span></a> on Super Protocol. Its purpose is to introduce you to the logic and sequence of the CLI commands.

## Prerequisites

Expand Down
234 changes: 234 additions & 0 deletions docs/cli/Guides/tgwui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
---
id: "tgwui"
title: "TGWUI and ComfyUI With Tunnels"
slug: "/guides/solutions/tgwui"
sidebar_position: 3
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

This guide provides step-by-step instructions for uploading and deploying an AI model on Super Protocol using Text Generation Web UI and ComfyUI, both already available in the Marketplace. However, the general workflow described here can be applied to any solution, whether new or existing.

## Prerequisites

- [SPCTL](https://docs.develop.superprotocol.com/cli/)
- BNB and SPPI tokens (opBNB) to pay for transactions and orders

## 1. Prepare

Ensure your model meets the Super Protocol requirements:

1.1. Your model must belong to a category supported by one of the <a id="engine"><span className="dashed-underline">engines</span></a>.

**Text Generation Web UI**:

- Text Generation
- Text Classification
- Translation
- Text2Text Generation

**ComfyUI**:

- Image Classification
- Object Detection
- Image Segmentation
- Text-to-Image
- Image-to-Text
- Image-to-Image
- Image-to-Video
- Video Classification
- Text-to-Video
- Mask Generation

If you plan to deploy a ComfyUI workflow with custom nodes, [prepare the files](/cli/guides/solutions/comfyui) before proceeding to the next step. For security reasons, you cannot upload custom nodes directly to a deployed ComfyUI.

1.2. Due to [testnet limitations](/marketplace/limitations), the total size of model files should not exceed 13 GB. Support for bigger models will be available in the future.

## 2. Upload the model

Upload the model:

```shell
./spctl files upload <MODEL_DIR> \
--output model.resource.json \
--use-addon
```

Replace `<MODEL_DIR>` with the path to the dataset directory, for example:

```shell
./spctl files upload ~/Downloads/models/SmolLM2-1.7B \
--output model.resource.json \
--use-addon
```

## 3. Deploy tunnels

3.1. Place an order to deploy a [confidential tunnel](/fundamentals/tunnels):

```shell
./spctl workflows create --tee 7 --solution 19
```

3.2. Wait for the order to be created, and find the tunnel order ID in the output, for example:

```text
Workflow was created, TEE order id: ["273899"]
```

3.3. Check the order status:

```shell
./spctl orders get <ORDER_ID>
```

Replace `<ORDER_ID>` with the tunnel order ID from the previous step.

3.4. When the status is `Done`, download the result:

```shell
./spctl orders download-result <ORDER_ID>
```

3.5. Extract the downloaded `result.tar.gz`, open `output/result.json`, and find the domain address. For example:

```json title="result.json"
"domain":"pret-tons-wade.superprotocol.io"
```

Your model's web UI will be available at this address.

## 4. Prepare engine configuration files

4.1. Open the SPCTL's `config.json` and find the `workflow.resultEncryption.key` property that contains the key used for decrypting workflow results; for example: `NapSrwQRz2tL9ZftJbi6DATpCDn0BRImpSStU9xZT/s=`.

4.2.
<Tabs>
<TabItem value="tgwui" label="TGWUI" default>
Create a file named `engine-configuration-tgwui.json` and paste the following:

```json title="engine-configuration-tgwui.json"
{
"engine": {
"main_settings": {
"character": {
"name": "Superprotocol AI",
"context": "The following is a conversation with an AI Large Language Model. The AI has been trained to answer questions, provide recommendations, and help with decision making. The AI follows user requests. The AI thinks outside the box.",
"greeting": "How can I help you today?"
},
"api": {},
"mode": {}
},
"model": {
"parameters": {
"temperature": 1,
"top_p": 1,
"top_k": 0,
"typical_p": 1
},
"parameters2": {
"min_p": 0.05,
"repetition_penalty": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}
},
"model_loader": {
"loader_name": "Autodetect"
}
},
"tunnels": {
"domain_settings": {
"provision_type": "Temporary Domain (on *.superprotocol.io)",
"tunnel_provisioner_order": {
"order_id": "",
"order_key": ""
}
}
}
}
```
</TabItem>
<TabItem value="comfyui" label="ComfyUI" default>
Create a file named `engine-configuration-comfyui.json` and paste the following:

```json title="engine-configuration-comfyui.json"
{
"engine": {
"main_settings": {
"preview_method": "none",
"preview_size": 512
}
},
"tunnels": {
"domain_settings": {
"provision_type": "Temporary Domain (on *.superprotocol.io)",
"tunnel_provisioner_order": {
"order_id": "",
"order_key": ""
}
}
}
}
```
</TabItem>
</Tabs>

In `tunnels.domain_settings.tunnel_provisioner_order`, set:

- `order_id` to your tunnel order ID from Step 3.2
- `order_key` to your encryption key from Step 4.1

Save and close the file.

## 5. Deploy the model

5.1.
<Tabs>
<TabItem value="tgwui" label="TGWUI" default>
Create the main order to deploy your uploaded model:

```shell
./spctl workflows create --tee <COMPUTE_OFFER> --solution 25 --solution-configuration ./engine-configuration-tgwui.json --data ./model.resource.json
```

Replace `<COMPUTE_OFFER>` with a selected compute offer. See available compute offer IDs on the [Marketplace](https://marketplace.superprotocol.com/).

Note that `--solution 25` refers to [Text Generation Web UI with GPU support](https://marketplace.superprotocol.com/marketplace/models?offer=offerId%3D25). If you need the CPU version, use `--solution 26` instead.
</TabItem>
<TabItem value="comfyui" label="ComfyUI" default>
Create the main order to deploy your uploaded model:

```shell
./spctl workflows create --tee <COMPUTE_OFFER> --solution 27 --solution-configuration ./engine-configuration-comfyui.json --data ./model.resource.json
```

Replace `<COMPUTE_OFFER>` with a selected compute offer. See available compute offer IDs on the [Marketplace](https://marketplace.superprotocol.com/).

Note that `--solution 27` refers to [ComfyUI UI with GPU support](https://marketplace.superprotocol.com/marketplace/models?offer=offerId%3D27). If you need the CPU version, use `--solution 28` instead.
</TabItem>
</Tabs>

5.2. Wait for the order to be created, and find the main order ID in the output, for example:

```text
Workflow was created, TEE order id: ["273900"]
```

5.3. Deployment may take 15-20 minutes or more, depending on the model size and other parameters. Check the domain from Step 3.5 every few minutes until the UI is available.

If you suspect something went wrong, check the order status:

```shell
./spctl orders get <MAIN_ORDER_ID>
```

Replace `<MAIN_ORDER_ID>` with the main order ID from the previous step.

The most important statuses (see the [full list](/fundamentals/orders#compute-order)):

- **Processing**: The compute is executing the order inside a TEE. Your model is either already available or will be available soon.
- **In Queue**: The order is waiting for the compute to become available. This status appears only if the compute is overloaded with orders. If this status persists for a few minutes, place a new main order the same tunnel order and engine configuration but another compute offer.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor grammar issue in the sentence.

The phrase "place a new main order the same tunnel order" is missing "with" between "order" and "the same".

📝 Suggested fix
-- **In Queue**: The order is waiting for the compute to become available. This status appears only if the compute is overloaded with orders. If this status persists for a few minutes, place a new main order the same tunnel order and engine configuration but another compute offer.
+- **In Queue**: The order is waiting for the compute to become available. This status appears only if the compute is overloaded with orders. If this status persists for a few minutes, place a new main order with the same tunnel order and engine configuration but another compute offer.
🤖 Prompt for AI Agents
In `@docs/cli/Guides/tgwui.md` at line 232, Fix the grammar in the sentence that
currently reads "place a new main order the same tunnel order" by inserting
"with" so it reads "place a new main order with the same tunnel order and engine
configuration but another compute offer," ensuring the rest of the sentence
remains unchanged.

- **Done**: The order is completed successfully and the model's UI is no longer available.
- **Error**: The order completed with an error. [Download the order results](/cli/commands/orders/download-result) to get more information about the error.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: "unsloth"
title: "Unsloth"
title: "Fine-Tuning With Unsloth"
slug: "/guides/solutions/unsloth"
sidebar_position: 3
sidebar_position: 5
---

This guide provides step-by-step instructions for fine-tuning an AI model using the Super Protocol packaging of [Unsloth](https://unsloth.ai/), an open-source framework for LLM fine-tuning and reinforcement learning.

The <a id="solution"><span className="dashed-underline">solution</span></a> allows you to run fine-tuning within Super Protocol's Trusted Execution Environment (TEE). This provides enhanced security and privacy and enables a range of [confidential collaboration](https://docs.develop.superprotocol.com/cli/guides/fine-tune) scenarios.
The <a id="solution"><span className="dashed-underline">solution</span></a> allows you to run fine-tuning within Super Protocol's Trusted Execution Environment (TEE). This provides enhanced security and privacy and enables a range of [confidential collaboration](https://docs.develop.superprotocol.com/cli/guides/multi-party-collab) scenarios.

## Prerequisites

Expand Down
8 changes: 3 additions & 5 deletions docs/cli/Guides/Solutions/vllm.md → docs/cli/Guides/vllm.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
id: "vllm"
title: "vLLM"
title: "Inference With vLLM"
slug: "/guides/solutions/vllm"
sidebar_position: 4
sidebar_position: 6
---

This guide provides step-by-step instructions for running an AI model inference using the Super Protocol packaging of [vLLM](https://www.vllm.ai/), an inference and serving engine for LLMs.

The <a id="solution"><span className="dashed-underline">solution</span></a> allows you to run LLM inference within Super Protocol's Trusted Execution Environment (TEE).
This guide provides step-by-step instructions for running an AI model inference using the Super Protocol packaging of [vLLM](https://www.vllm.ai/), an inference and serving engine for LLMs. This <a id="solution"><span className="dashed-underline">solution</span></a> allows you to run LLM inference within Super Protocol's Trusted Execution Environment (TEE).

## Prerequisites

Expand Down
Loading