NVIDIAのAIで音声認識と翻訳
How to Use NVIDIA Canary-1B-v2 for ASR, Translation, and Automatic SRT Subtitle Export in Python
NVIDIAのAI「Canary-1B-v2」で、音声認識から多言語翻訳、字幕作成まで自動で行う手順が公開。実際の音声から多言語字幕を簡単に作れ、大規模な文字起こしに役立ちます。
このチュートリアルでは、NVIDIA Canary-1B-v2 を使用して音声認識と翻訳のワークフローを構築します。まず、必要な audio、NeMo、NumPy、SciPy の依存関係を設定し、効率的な推論のために Canary モデルを GPU 対応のランタイムにロードします。そこから、音声をクリーンな 16 kHz モノラル形式に準備し、英語の ASR を実行し、音声を複数の言語に翻訳し、単語とセグメントのタイムスタンプを生成し、翻訳された字幕を SRT ファイルとしてエクスポートし、長尺の文字起こしをテストし、バッチ処理を実行し、推論速度をベンチマークします。最終的には、実際の音声ファイル、字幕生成、大規模な文字起こし実験に適用できる、完全な多言語 ASR および音声翻訳パイプラインが完成します。 Installing NeMo, Audio Libraries, NumPy, and SciPy Dependencies コードをコピー コピー済み 別のブラウザを使用 import os, subprocess, sys SENTINEL = "/content/.canary_setup_done" if not os.path.exists(SENTINEL): def sh(c): print("$", c); subprocess.run(c, shell=True, check=False) print(">>> PHASE 1: installing dependencies (one-time)...\n") sh("apt-get -qq update") sh("apt-get -qq install -y libsndfile1 ffmpeg > /dev/null") sh('pip install -q "nemo_toolkit[asr]"') sh("pip install -q librosa soundfile pydub") sh('pip install -q --force-reinstall --no-cache-dir "numpy>=2.2,<2.4" "scipy>=1.15"') open(SENTINEL, "w").write("done") print("\n Setup complete. Restarting the runtime now.") print(" When it reconnects, RUN THIS CELL AGAIN to start the tutorial.") os.kill(os.getpid(), 9) NVIDIA Canary-1B-v2 チュートリアルの環境をセットアップします。必要なシステムパッケージ、NeMo ASR toolkit、audio libraries、および互換性のある NumPy と SciPy のバージョンをインストールします。その後、セットアップマーカーを作成し、ランタイムを再起動して、メインチュートリアルを実行する前に更新された依存関係がクリーンにロードされるようにします。 Loading NVIDIA Canary-1B-v2 and Checking GPU Availability コードをコピー コピー済み 別のブラウザを使用 import time, json, gc, math, urllib.request import torch, numpy as np, s
この記事について質問
記事の内容に答えます。記事外のことは都度ウェブで調べます。