### Install Salad Cloud Transcription SDK Source: https://docs.salad.com/transcription/how-to-guides/sdk/python-sdk-quick-start Installs the SaladCloud Transcription SDK using pip. This is the first step before using the SDK in your Python project. ```bash pip install salad-cloud-transcription-sdk ``` -------------------------------- ### Example IPv6 Enabled Server API - GET Request Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image Demonstrates how to perform a GET request to the example server API to retrieve a randomly generated string unique to the machine. This requires the 'curl' command and the Salad URL of the deployment. ```bash curl -H "Content-type: application/json" 'https://{saladURL}/' ``` -------------------------------- ### Set Up Development Environment for OpenVoice Source: https://docs.salad.com/container-engine/how-to-guides/ai-machine-learning/openvoice-tts-voice-cloning This command executes a setup script to establish a clean virtual environment and install all necessary libraries for the OpenVoice project. Ensure you are in the correct directory before running. ```bash bash dev/setup ``` -------------------------------- ### Local Development Setup Script (Bash) Source: https://docs.salad.com/container-engine/how-to-guides/ai-machine-learning/metavoice-tts-voice-cloning This Bash script automates the setup of a local development environment for the MetaVoice project. It handles virtual environment creation, activation, and the installation of FFmpeg, a crucial dependency for media processing. ```bash set -e echo "setup the curent environment" CURRENT_DIRECTORY="$( dirname "${BASH_SOURCE[0]}" )" cd "${CURRENT_DIRECTORY}" echo "current directory: $( pwd )" echo "setup development environment" METAVOICE="$( cd .. && pwd )" echo "dev directory set to: ${METAVOICE}" echo "remove old virtual environment" rm -rf "${METAVOICE}/.venv" echo "create new virtual environment" python3.10 -m venv "${METAVOICE}/.venv" echo "activate virtual environment" source "${METAVOICE}/.venv/bin/activate" cd "${METAVOICE}" # install ffmpeg echo "installing ffmpeg" wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5 md5sum -c ffmpeg-git-amd64-static.tar.xz.md5 tar xvf ffmpeg-git-amd64-static.tar.xz sudo mv ffmpeg-git-*-static/ffprobe ffmpeg-git-*-static/ffmpeg /usr/local/bin/ rm -rf ffmpeg-git-* ``` -------------------------------- ### Setup Script for Open Voice Development Environment Source: https://docs.salad.com/container-engine/how-to-guides/ai-machine-learning/openvoice-tts-voice-cloning This bash script sets up the local development environment for Open Voice. It creates and activates a Python virtual environment, installs project dependencies from requirements.txt, and installs specific versions of PyTorch, TorchVision, and Torchaudio. Ensure Python 3.9 is available. ```bash #! /bin/bash set -e echo "setup the curent environment" CURRENT_DIRECTORY="$( dirname "${BASH_SOURCE[0]}" )" cd "${CURRENT_DIRECTORY}" echo "current directory: $( pwd )" echo "setup development environment for inference" OPENVOICE_DIR="$( cd .. && pwd )" echo "dev directory set to: ${OPENVOICE_DIR}" echo "remove old virtual environment" rm -rf "${OPENVOICE_DIR}/.venv" echo "create new virtual environment" python3.9 -m venv "${OPENVOICE_DIR}/.venv" echo "activate virtual environment" source "${OPENVOICE_DIR}/.venv/bin/activate" echo "installing dependencies ..." (cd "${OPENVOICE_DIR}" && pip install --upgrade pip && pip install -r requirements.txt) pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 ``` -------------------------------- ### Using the Example Image Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image Instructions on how to navigate and utilize the SaladCloud example image, including entering the application directory and understanding the purpose of the long-running sleep process. ```APIDOC ## Using the Image ### Description This section provides guidance on how to use the SaladCloud example image effectively. ### Navigation Enter the `/app` directory using the command `cd /app`. ### Startup Process The image is configured to start with a long `sleep` process (approximately 16 years) to maintain instance uptime. Terminating this process will shut down the instance. ### Recommended Usage This image is best suited for testing SaladCloud functionality, verifying deployment configurations, or performing single-use tests for applications. SaladCloud Replicas are designed to be stateless; stateful interactions are not recommended as replicas can be reallocated at any time, leading to data loss. Changes made on one replica may not persist across others. ``` -------------------------------- ### Dockerfile Examples for PyTorch with CUDA Source: https://docs.salad.com/container-engine/how-to-guides/migration/migrate-from-runpod Examples of Dockerfile instructions to use pre-built PyTorch images with CUDA support. These images eliminate the need for manual CUDA driver and dependency installation, simplifying environment setup for GPU workloads on SaladCloud. ```dockerfile # Pre-built PyTorch with latest CUDA support - no manual setup required FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-runtime ``` ```dockerfile # Or NVIDIA's optimized PyTorch container with CUDA 12.6 FROM nvcr.io/nvidia/pytorch:25.01-py3 ``` -------------------------------- ### GET /status Source: https://docs.salad.com/reference/imds Retrieves the health statuses of the current container instance, indicating if it's ready and started. ```APIDOC ## GET /status ### Description Retrieves the health statuses of the current container instance. This endpoint provides information about whether the container is ready and has started, based on configured probes. ### Method GET ### Endpoint /status ### Parameters #### Query Parameters - **Metadata** (string) - Required - Required header to indicate metadata request. Available options: `true` ### Request Example ```python from salad_cloud_imds_sdk import SaladCloudImdsSdk sdk = SaladCloudImdsSdk( timeout=10000 ) result = sdk.metadata.get_status() print(result) ``` ### Response #### Success Response (200) - **ready** (boolean) - Required - `true` if the running container is ready. Returns the latest readiness probe result, or `true` if no probe is defined. - **started** (boolean) - Required - `true` if the running container is started. Returns the latest startup probe result, or `true` if no probe is defined. #### Response Example ```json { "ready": true, "started": true } ``` #### Error Responses - **403** - **404** - **default** ``` -------------------------------- ### Docker Build and Push Commands Source: https://docs.salad.com/container-engine/tutorials/quickstart Shell commands to build a Docker image for the application and push it to a container registry (Docker Hub in this example). Supports images up to 35 GB compressed. ```shell docker build -t saladtechnologies/misc:hello-world . docker push saladtechnologies/misc:hello-world ``` -------------------------------- ### Display All Included Information - Shell Script Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image Runs a readme script that displays all the information about the included tools and examples within the container. ```bash readme.sh ``` -------------------------------- ### Basic Dockerfile for PyTorch Application Source: https://docs.salad.com/container-engine/how-to-guides/migration/migrate-from-runpod A foundational Dockerfile example for creating a containerized PyTorch application. It starts from a pre-built PyTorch+CUDA image, sets a working directory, installs dependencies from a requirements file, and copies application code into the image. ```dockerfile # Start with a pre-built PyTorch+CUDA image (no manual CUDA setup!) FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-runtime WORKDIR /app # Install additional dependencies (same as pip install on RunPod) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code (same as uploading your files) COPY . . ``` -------------------------------- ### Get Container Status using IMDS SDK Source: https://docs.salad.com/container-engine/how-to-guides/imds/container-status-endpoint Retrieves the current status of the running container using the IMDS SDK. This function is available across multiple programming languages and returns a JSON object indicating the 'ready' and 'started' states of the container. Ensure the IMDS SDK is installed for your respective language. ```python from salad_cloud_imds_sdk import SaladCloudImdsSdk, Environment sdk = SaladCloudImdsSdk( base_url=Environment.DEFAULT.value, timeout=10000 ) result = sdk.metadata.get_container_status() print(result) ``` ```csharp using Salad.Cloud.IMDS.SDK; var client = new SaladCloudImdsSdkClient(); var response = await client.Metadata.GetContainerStatusAsync(); Console.WriteLine(response); ``` ```go import ( "fmt" "encoding/json" "github.com/saladtechnologies/salad-cloud-imds-sdk-go/pkg/saladcloudimdssdkconfig" "github.com/saladtechnologies/salad-cloud-imds-sdk-go/pkg/saladcloudimdssdk" ) config := saladcloudimdssdkconfig.NewConfig() client := saladcloudimdssdk.NewSaladCloudImdsSdk(config) response, err := client.Metadata.GetContainerStatus(context.Background()) if err != nil { panic(err) } fmt.Print(response) ``` ```java import com.salad.cloud.imdssdk.SaladCloudImdsSdk; import com.salad.cloud.imdssdk.models.ContainerStatus; public class Main { public static void main(String[] args) { SaladCloudImdsSdk saladCloudImdsSdk = new SaladCloudImdsSdk(); ContainerStatus response = saladCloudImdsSdk.metadataService.getContainerStatus(); System.out.println(response); } } ``` ```typescript import { SaladCloudImdsSdk } from '@saladtechnologies-oss/salad-cloud-imds-sdk' ;(async () => { const saladCloudImdsSdk = new SaladCloudImdsSdk({}) const { data } = await saladCloudImdsSdk.metadata.getContainerStatus() console.log(data) })() ``` ```php "http://169.254.169.254/v1/status", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### FastAPI Application for SaladCloud Source: https://docs.salad.com/container-engine/tutorials/quickstart A Python FastAPI application with a /hello endpoint that demonstrates environment variable injection and includes basic probe endpoints for /started, /live, and /ready. It uses the 'fastapi' and 'os' libraries. ```python from fastapi import FastAPI import os salad_machine_id = os.getenv("SALAD_MACHINE_ID", "localhost") app = FastAPI() @app.get("/hello") async def hello_world(): return {"message": "Hello, World!", "salad_machine_id": salad_machine_id} @app.get("/started") async def startup_probe(): return {"message": "Started!"} @app.get("/ready") async def readiness_probe(): return {"message": "Ready!"} @app.get("/live") async def liveness_probe(): return {"message": "Live!"} ``` -------------------------------- ### Multichannel Transcription Output (Word-Level) Source: https://docs.salad.com/transcription/how-to-guides Example of the output format for multichannel transcription with word-level diarization. Each word segment includes the transcribed word, start and end timestamps, speaker, and channel information. ```json { "word_segments": [ { "word": "Okay,", "start": 0.324, "end": 0.566, "timestamp": [ 0.324, 0.566 ], "speaker": "SPEAKER_0", "channel": 0 } ] } ``` -------------------------------- ### Included Tools Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image A list of command-line tools available in the SaladCloud example image for checking instance hardware, network, and processes. ```APIDOC ## Included Tools ### Description The following command-line tools are pre-installed in the example image: 1. **nvidia-smi**: Check the GPU model in the instance. 2. **neofetch**: Check the hardware specifications of the instance (Note: does not display GPU information). 3. **curl & wget**: Download files and interact with websites. 4. **nano**: Edit files on the instance. 5. **ping**: Test external network connectivity from the instance. 6. **btop**: Monitor running processes and system statistics. ``` -------------------------------- ### Audio Transcription Output with Sentence Diarization Source: https://docs.salad.com/transcription/how-to-guides Example of the output format when sentence diarization is enabled for audio transcription. The output includes an array of sentence-level timestamps, each with text, start and end times, and the identified speaker. ```json { "sentence_level_timestamps": [ { "text": "I understand something.", "timestamp": [ 4.64, 6.82 ], "start": 4.64, "end": 6.82, "speaker": "SPEAKER_00" } ] } ``` -------------------------------- ### Dockerfile for FastAPI Application Source: https://docs.salad.com/container-engine/tutorials/quickstart A Dockerfile to containerize the FastAPI application. It uses a Python 3.13 slim image, installs dependencies from requirements.txt, copies the application code, and runs the Uvicorn server, ensuring it listens on all interfaces for SaladCloud compatibility. ```dockerfile FROM python:3.13-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . # It is important to use "--host *" to allow access on ipv6 # networks, such as SaladCloud. CMD ["uvicorn", "app:app", "--host", "*", "--port", "8000"] ``` -------------------------------- ### Create Dockerfile for Node.js App Source: https://docs.salad.com/container-engine/tutorials/nodejs/create-a-container This Dockerfile defines the build instructions for a Node.js application. It specifies the base image (Node.js version 16), sets the working directory, copies and installs dependencies, copies application code, exposes the application port, and defines the command to start the application. ```dockerfile FROM node:16.18.0 #Create app directory WORKDIR /app #Install the app dependencies using the npm binary. COPY package*.json $. RUN npm install #Copy the rest of the application to the app directory. COPY . /app #Expose the port and start the application. EXPOSE 5000 CMD [ "npm", "start" ] ``` -------------------------------- ### Install Truss Python Package Source: https://docs.salad.com/container-engine/tutorials/machine-learning/how-to-deploy-a-truss-container-to-salad-portal-and-api Installs the Truss library using pip. This is a prerequisite for creating and managing Truss containers. Ensure you have Python version 3.7 or higher (but less than 3.11) installed. ```shell pip install truss ``` -------------------------------- ### Initialize Project and Download Model Weights Source: https://docs.salad.com/container-engine/how-to-guides/ai-machine-learning/deploy-video-generation-comfy Commands to create a project directory, initialize a git repository, and download necessary model weights using wget. This sets up the foundation for the video generation API. ```bash mkdir video-generation-api cd video-generation-api git init wget https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltx-video-2b-v0.9.1.safetensors wget https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/text_encoders/t5xxl_fp16.safetensors ``` -------------------------------- ### Get Container Instance Status using Salad Cloud IMDS SDK (Python) Source: https://docs.salad.com/reference/imds This snippet shows how to initialize the Salad Cloud IMDS SDK and retrieve the status of the current container instance. It handles potential HTTP errors by printing the result, which is expected to be a JSON object with 'ready' and 'started' booleans. ```python from salad_cloud_imds_sdk import SaladCloudImdsSdk sdk = SaladCloudImdsSdk( timeout=10000 ) result = sdk.metadata.get_status() print(result) ``` -------------------------------- ### Dockerfile: Initial Setup with s6 Overlay Source: https://docs.salad.com/container-engine/how-to-guides/job-processing/queue-worker This Dockerfile snippet shows the initial setup for a container using the s6 overlay for process management. It copies the s6 overlay configuration and sets environment variables and the entrypoint for the container. ```dockerfile COPY --chmod=755 s6 /etc/ ENV S6_KEEP_ENV=1 ENTRYPOINT ["/init"] CMD ["/usr/local/bin/salad-http-job-queue-worker"] ``` -------------------------------- ### Included Scripts and Examples Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image Details on various scripts and examples provided within the SaladCloud example image, such as environment variable testing, JWT retrieval, readiness/liveness probes, and speed tests. ```APIDOC ## Included Scripts and Examples ### Description The example image contains the following scripts and examples: 1. **Example IPv6 enabled server API**: An IPv6 compatible server with three endpoints as detailed in the 'Example IPv6 Enabled Server API' section. 2. **Example Environment Variable definitions**: Run `./env_test.sh` to display example environment variables defined for the container group. 3. **Example JWT retrieval from Instance Metadata Service (IMDS)**: Run `python3 jwt.py` to obtain the current JWT from the IMDS. This is only accessible when deployed on SaladCloud. 4. **Readiness probe test**: Run `./readiness-probe.sh` to temporarily disable the container instance's ready status for 2 minutes. 5. **Liveness probe**: The container has a liveness probe that checks for the existence of a 'liveness' file. Removing this file will cause the container to exit and reallocate. 6. **Speedtest**: Run `./speedtest.sh` to perform an internet speed test. Note that results may vary. ``` -------------------------------- ### Example IPv6 Enabled Server API Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image This section details the API endpoints of an example IPv6-enabled server included in the SaladCloud image. It covers how to interact with the server to get a unique string, send messages, and set custom strings. ```APIDOC ## GET /api/example-server ### Description Retrieves a randomly generated string unique to the machine. ### Method GET ### Endpoint `https://{saladURL}/` ### Parameters None ### Request Example ```bash curl -H "Content-type: application/json" 'https://{saladURL}/' ``` ### Response #### Success Response (200) - **string** (string) - A randomly generated unique string. #### Response Example ```json { "data": "a-unique-random-string" } ``` ## POST /api/example-server/hello ### Description Sends a message to the server and receives a response based on the message content. Only 'Hello' and 'Goodbye' are supported messages. ### Method POST ### Endpoint `https://{saladURL}/hello` ### Parameters #### Request Body - **message** (string) - Required - The message to send. Must be either 'Hello' or 'Goodbye'. ### Request Example ```bash curl -XPOST -H "Content-type: application/json" -d '{"message": "Hello"}' 'https://{saladURL}/hello' ``` ### Response #### Success Response (200) - **response** (string) - Either 'Hello' or 'Goodbye' based on the input message. #### Response Example ```json { "response": "Hello" } ``` ## POST /api/example-server/set ### Description Sets a custom string that will be returned by the GET `/` endpoint. ### Method POST ### Endpoint `https://{saladURL}/set` ### Parameters #### Request Body - **set** (string) - Required - The custom string to set. ### Request Example ```bash curl -XPOST -H "Content-type: application/json" -d '{"set": "example_text"}' 'https://{saladURL}/set' ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the string was set. #### Response Example ```json { "message": "String set successfully." } ``` ``` -------------------------------- ### SaladCloud Health Probe Configuration (SDK) Source: https://docs.salad.com/container-engine/how-to-guides/migration/migrate-from-vast Example of configuring startup, liveness, and readiness probes using the SaladCloud SDK. This configuration defines the HTTP paths, ports, and timing parameters for each probe. Requires the 'salad_cloud_sdk' library. ```python # Example: SDK configuration for health probes from salad_cloud_sdk.models import ContainerGroupCreationRequest request = ContainerGroupCreationRequest( # ... other configuration startup_probe={ "http": { "path": "/started", "port": 8000, "scheme": "http" }, "initial_delay_seconds": 10, "period_seconds": 5, "timeout_seconds": 3, "failure_threshold": 3 }, liveness_probe={ "http": { "path": "/health", "port": 8000, "scheme": "http" }, "initial_delay_seconds": 30, "period_seconds": 10, "timeout_seconds": 5, "failure_threshold": 3 }, readiness_probe={ "http": { "path": "/ready", "port": 8000, "scheme": "http" }, "initial_delay_seconds": 5, "period_seconds": 5, "timeout_seconds": 3, "failure_threshold": 3 } ) ``` -------------------------------- ### Install psutil Library Source: https://docs.salad.com/container-engine/tutorials/performance/performance-monitoring This command installs the psutil library, a cross-platform utility for retrieving system information. It is a prerequisite for using the Python code examples. ```bash pip install psutil ``` -------------------------------- ### Start Logstash Service Source: https://docs.salad.com/container-engine/how-to-guides/external-logging/tcp-logging Starts the Logstash service using a specified configuration file. This command assumes Logstash is installed and the configuration file (e.g., logstash.conf) is present. ```shell $ bin/logstash -f logstash.conf ``` -------------------------------- ### Start Object Detection Process Source: https://docs.salad.com/container-engine/tutorials/computer-vision/yolov8-deployment-tutorial Initiates the object detection process as a background task. Requires parameters for the input link, live stream status, container name, saving timer, and storage key. ```APIDOC ## POST /start ### Description Initiates the object detection process as a background task. It accepts parameters like **link**, **live**, **container**, **saving timer**, and **storage_key** necessary for the process. ### Method POST ### Endpoint /start ### Parameters #### Query Parameters - **link** (string) - Required - The link to the video or stream. - **live** (boolean) - Required - Whether the input is a live stream. - **container** (string) - Required - The name of the container to use for processing. - **saving_timer** (integer) - Required - The interval in seconds for saving results. - **storage_key** (string) - Required - The key for accessing the storage account. ### Request Example ```json { "link": "rtsp://example.com/stream", "live": true, "container": "my-container", "saving_timer": 30, "storage_key": "your_storage_key" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the process has started. #### Response Example ```json { "status": "Process started" } ``` ``` -------------------------------- ### Additional Information Source: https://docs.salad.com/container-engine/tutorials/getting-started/example-image Provides supplementary details about the SaladCloud example image, including its base operating system, included software, and methods for importing files. ```APIDOC ## Additional Information ### Description This section contains extra details about the SaladCloud example image. ### Base OS and Software - The image is based on Ubuntu 24.04 LTS. - Python 3 is included. ### Importing Files Files can be imported into the instance using `curl` or `wget`. ```