### Install Dependencies and Download Model Weights (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Install necessary Python packages, download the Qwen3-ASR model weights, and generate the tokenizer. This is a prerequisite for building the project from source. ```bash pip install huggingface_hub transformers huggingface-cli download Qwen/Qwen3-ASR-0.6B --local-dir Qwen3-ASR-0.6B python -c " from transformers import AutoTokenizer tok = AutoTokenizer.from_pretrained('Qwen3-ASR-0.6B', trust_remote_code=True) tok.backend_tokenizer.save('Qwen3-ASR-0.6B/tokenizer.json') " ``` -------------------------------- ### Quick Install Qwen3 ASR Skill Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md Use this script for a quick and recommended installation of the Qwen3 ASR skill. It clones the repository, copies necessary files, and downloads platform-specific releases and models. ```bash SKILL_DIR="${HOME}/.openclaw/skills/audio_asr" mkdir -p "$SKILL_DIR" # Clone the repo git clone --depth 1 https://github.com/second-state/qwen3_asr_rs.git /tmp/qwen3-asr-repo cp -r /tmp/qwen3-asr-repo/skills/* "$SKILL_DIR" rm -rf /tmp/qwen3-asr-repo # Download platform-specific release and model "${SKILL_DIR}/bootstrap.sh" ``` -------------------------------- ### Verify Qwen3 ASR Skill Installation Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md After installation, use this command to verify that the Qwen3 ASR skill is working correctly by transcribing an audio file. ```bash ~/.openclaw/skills/audio_asr/scripts/asr \ ~/.openclaw/skills/audio_asr/scripts/models/Qwen3-ASR-0.6B \ /path/to/audio.wav ``` -------------------------------- ### Manual Installation: Download Model Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md Manually download the Qwen3-ASR-0.6B model using `huggingface-cli` and save it to the specified local directory. ```bash huggingface-cli download Qwen/Qwen3-ASR-0.6B \ --local-dir ~/.openclaw/skills/audio_asr/scripts/models/Qwen3-ASR-0.6B ``` -------------------------------- ### Install Qwen3 ASR CLI Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Run this script to automatically detect your platform, download the correct release binary, model weights, and a sample audio file. Follow the prompts for model size and GPU usage. ```bash curl -sSf https://raw.githubusercontent.com/second-state/qwen3_asr_rs/main/install.sh | bash ``` -------------------------------- ### Start Qwen3 ASR API Server Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Run the `asr-server` binary, specifying the path to the model directory. The server defaults to host 0.0.0.0 and port 8080. ```bash asr-server --model-dir ./Qwen3-ASR-0.6B ``` -------------------------------- ### Perform First Transcription Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md After installation, navigate to the project directory and use the `asr` command with the model and a sample audio file to generate text. ```bash cd qwen3_asr_rs ./asr ./Qwen3-ASR-0.6B sample.wav ``` -------------------------------- ### CLI Transcription Usage Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Examples of how to use the `asr` CLI tool for basic and language-specific audio transcription. ```APIDOC ## CLI Transcription Usage ### Basic transcription (auto-detect language) ```bash asr ./Qwen3-ASR-0.6B input.wav ``` ### Force language ```bash asr ./Qwen3-ASR-0.6B input.wav chinese asr ./Qwen3-ASR-0.6B input.wav english ``` ### Enable debug logging ```bash RUST_LOG=debug asr ./Qwen3-ASR-0.6B input.wav ``` ### Output Format ``` Language: Chinese Text: 你好世界 ``` ``` -------------------------------- ### Build for Linux with LibTorch (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Install dependencies and build the project for Linux using the libtorch backend. Ensure libtorch has been downloaded and environment variables are set. ```bash cargo build --release ``` -------------------------------- ### Manual Installation: Copy Scripts Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md If automatic download fails, manually extract the downloaded zip file for your platform and copy its contents to the scripts directory. Ensure the 'asr' executable has execute permissions. ```bash SCRIPTS=~/.openclaw/skills/audio_asr/scripts mkdir -p "$SCRIPTS" unzip asr-.zip cp -r asr-/* "$SCRIPTS/" chmod +x "$SCRIPTS/asr" ``` -------------------------------- ### Manual Installation: Generate Tokenizer Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md Generate the `tokenizer.json` file required for the Qwen3 ASR skill. This involves using `transformers.AutoTokenizer` to load the model and save its backend tokenizer. ```python from transformers import AutoTokenizer import os path = os.path.expanduser('~/.openclaw/skills/audio_asr/scripts/models/Qwen3-ASR-0.6B') tok = AutoTokenizer.from_pretrained(path, trust_remote_code=True) tok.backend_tokenizer.save(f'{path}/tokenizer.json') print(f'Saved {path}/tokenizer.json') ``` -------------------------------- ### API Server - POST /v1/audio/transcriptions Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Documentation for the OpenAI-compatible transcription endpoint, detailing parameters, request examples, and response formats. ```APIDOC ## POST /v1/audio/transcriptions OpenAI-compatible transcription endpoint. Accepts multipart form data. ### Parameters #### Request Body - **file** (binary) - Required - Audio file (any format supported by FFmpeg) - **language** (string) - Optional - Language hint (e.g., `english`, `chinese`) - **response_format** (string) - Optional - `json` (default), `text`, or `verbose_json` - **model** (string) - Optional - Accepted for compatibility, ignored - **temperature** (float) - Optional - Accepted for compatibility, ignored - **prompt** (string) - Optional - Accepted for compatibility, ignored ### Request Example ```bash # JSON response (default) curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav # {"text":"Thank you for your contribution..."} # Plain text response curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F response_format=text # Thank you for your contribution... # Verbose JSON with language and duration curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F response_format=verbose_json # {"task":"transcribe","language":"English","duration":7.999,"text":"Thank you..."} # Force language curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F language=chinese ``` ### Response #### Success Response (200) - **text** (string) - The transcribed text. - **task** (string) - The type of task performed (e.g., `transcribe`). - **language** (string) - The detected or specified language. - **duration** (float) - The duration of the audio in seconds. #### Response Example ```json { "task": "transcribe", "language": "English", "duration": 7.999, "text": "Thank you for your contribution to the most recent issue of Computer." } ``` ``` -------------------------------- ### POST /v1/audio/transcriptions JSON Response Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Example of a JSON response from the transcription endpoint when `response_format` is set to `json` (default). ```bash curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav # {"text":"Thank you for your contribution..."} ``` -------------------------------- ### POST /v1/audio/transcriptions Plain Text Response Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Example of a plain text response from the transcription endpoint when `response_format` is set to `text`. ```bash curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F response_format=text # Thank you for your contribution... ``` -------------------------------- ### POST /v1/audio/transcriptions Force Language Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Example of forcing a specific language for transcription using the `language` parameter in the POST request. ```bash curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F language=chinese ``` -------------------------------- ### Enable Debug Logging for ASR Source: https://github.com/second-state/qwen3_asr_rs/blob/main/CLAUDE.md Run the ASR tool with debug logging enabled to get detailed information about the transcription process. This is helpful for troubleshooting. ```bash RUST_LOG=debug ./target/release/asr ./Qwen3-ASR-0.6B test_audio/sample1.wav ``` -------------------------------- ### POST /v1/audio/transcriptions Verbose JSON Response Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Example of a verbose JSON response from the transcription endpoint when `response_format` is set to `verbose_json`. Includes task, language, duration, and text. ```bash curl -X POST http://localhost:8080/v1/audio/transcriptions \ -F file=@recording.wav \ -F response_format=verbose_json # {"task":"transcribe","language":"English","duration":7.999,"text":"Thank you..."} ``` -------------------------------- ### Build Commands for Qwen3-ASR-RS Source: https://github.com/second-state/qwen3_asr_rs/blob/main/CLAUDE.md Commands to build the Qwen3-ASR-RS project. Use the MLX backend on macOS for Apple Silicon, and the libtorch backend on Linux. Features like 'mlx' and 'build-ffmpeg' are mutually exclusive and affect the build process. ```bash # macOS (MLX backend — recommended for Apple Silicon) git submodule update --init --recursive cargo build --release --no-default-features --features mlx,build-ffmpeg ``` ```bash # Linux (libtorch backend) export LIBTORCH=$(pwd)/libtorch export LIBTORCH_BYPASS_VERSION_CHECK=1 cargo build --release --features build-ffmpeg ``` -------------------------------- ### Troubleshooting: Check Platform Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md Determine your operating system and architecture using `uname` to ensure compatibility with the available Qwen3 ASR skill releases. ```bash echo "OS: $(uname -s), Arch: $(uname -m)" ``` -------------------------------- ### List Available Models (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Use this command to list the models available through the API. Ensure the API server is running at http://localhost:8080. ```bash curl http://localhost:8080/v1/models # {"object":"list","data":[{"id":"qwen3-asr","object":"model","owned_by":"qwen"}]} ``` -------------------------------- ### Qwen3 ASR API Server Options Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Configuration options for the `asr-server`, including model directory, host, port, default language, and verbosity. ```bash --model-dir Path to the Qwen3-ASR model directory (required) --host Host address to bind to (default: 0.0.0.0) --port Port to listen on (default: 8080) --language Default language for transcription (e.g., chinese, english) -v, -vv Verbose output (debug, trace) ``` -------------------------------- ### Basic Transcription with Qwen3 ASR CLI Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Use the `asr` command to transcribe an audio file. The tool automatically detects the language. ```bash asr ./Qwen3-ASR-0.6B input.wav ``` -------------------------------- ### Build for macOS with MLX (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Build the project for macOS using the MLX backend. Ensure Git submodules are updated before building. ```bash git submodule update --init --recursive cargo build --release --no-default-features --features mlx ``` -------------------------------- ### Troubleshooting: Check Network Connectivity Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/install.md Use `curl` to check if you can reach the GitHub releases page, which can help diagnose download failures. ```bash curl -I "https://github.com/second-state/qwen3_asr_rs/releases/latest" ``` -------------------------------- ### Download LibTorch for Linux (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Download and extract the appropriate libtorch version for your Linux environment (CPU or CUDA, x86_64 or ARM64). This is required for building with the libtorch backend. ```bash # Linux x86_64 (CPU) curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-x86_64-2.7.1.tar.gz tar xzf libtorch-cxx11-abi-x86_64-2.7.1.tar.gz # Linux x86_64 (CUDA 12.6) curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-x86_64-cuda12.6-2.7.1.tar.gz tar xzf libtorch-cxx11-abi-x86_64-cuda12.6-2.7.1.tar.gz # Linux ARM64 (CPU) curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-aarch64-2.7.1.tar.gz tar xzf libtorch-cxx11-abi-aarch64-2.7.1.tar.gz # Linux ARM64 (CUDA 12.6 / Jetson) curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-aarch64-cuda12.6-2.7.1.tar.gz tar xzf libtorch-cxx11-abi-aarch64-cuda12.6-2.7.1.tar.gz ``` -------------------------------- ### Enable Debug Logging for Qwen3 ASR CLI Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md To enable debug logging, set the `RUST_LOG` environment variable to `debug` before running the `asr` command. ```bash RUST_LOG=debug asr ./Qwen3-ASR-0.6B input.wav ``` -------------------------------- ### Basic Transcription with ASR Source: https://github.com/second-state/qwen3_asr_rs/blob/main/CLAUDE.md Execute a basic transcription of an audio file using the ASR tool. Specify the model path and the audio file path. ```bash ./target/release/asr ./Qwen3-ASR-0.6B test_audio/sample1.wav ``` -------------------------------- ### Transcribe Audio File Source: https://github.com/second-state/qwen3_asr_rs/blob/main/skills/SKILL.md Use the `asr` binary to transcribe an audio file. Specify the model path and the audio file path as arguments. Any FFmpeg-supported audio format is accepted. ```shell {baseDir}/scripts/asr \ {baseDir}/scripts/models/Qwen3-ASR-0.6B \ ``` ```shell {baseDir}/scripts/asr \ {baseDir}/scripts/models/Qwen3-ASR-0.6B \ recording.wav ``` ```shell {baseDir}/scripts/asr \ {baseDir}/scripts/models/Qwen3-ASR-0.6B \ /path/to/audio.wav ``` -------------------------------- ### Force Language Transcription with Qwen3 ASR CLI Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Specify the language for transcription by providing the language code (e.g., `chinese`, `english`) as an argument after the audio file. ```bash asr ./Qwen3-ASR-0.6B input.wav chinese asr ./Qwen3-ASR-0.6B input.wav english ``` -------------------------------- ### List Available Models Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Retrieves a list of all available ASR models supported by the service. ```APIDOC ## GET /v1/models ### Description Lists available models. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **object** (string) - Type of the response object, typically "list". - **data** (array) - An array of model objects. - **id** (string) - The unique identifier for the model. - **object** (string) - The type of the object, typically "model". - **owned_by** (string) - The owner of the model. ### Response Example ```json { "object": "list", "data": [ { "id": "qwen3-asr", "object": "model", "owned_by": "qwen" } ] } ``` ``` -------------------------------- ### Health Check Endpoint (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Check the health status of the API server by sending a request to the /health endpoint. A response of {"status":"ok"} indicates the server is running. ```bash curl http://localhost:8080/health # {"status":"ok"} ``` -------------------------------- ### Force Language Transcription Source: https://github.com/second-state/qwen3_asr_rs/blob/main/CLAUDE.md Perform transcription while explicitly setting the expected language. This is useful for multilingual models or when language detection might be uncertain. ```bash ./target/release/asr ./Qwen3-ASR-0.6B test_audio/sample3.wav chinese ``` -------------------------------- ### Set Environment Variables for LibTorch (Bash) Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Set the LIBTORCH environment variable to the path where libtorch was extracted and bypass version checks. These variables are necessary for the build process on Linux. ```bash export LIBTORCH=$(pwd)/libtorch export LIBTORCH_BYPASS_VERSION_CHECK=1 ``` -------------------------------- ### Health Check Source: https://github.com/second-state/qwen3_asr_rs/blob/main/README.md Checks the health status of the ASR service. ```APIDOC ## GET /health ### Description Health check endpoint. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - The health status of the service, typically "ok". ### Response Example ```json { "status": "ok" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.