BunaML’s diary

機械学習、音声・自然言語、Machine Learning, NLP, Audio, Software Development

NGCでPileをダウンロードする手順

*Pileを入手する手段は2023年末時点でほぼなくなり、以下の方法ではPileは結局ダウンロードできない。

ngc.nvidia.com

1. NGCのダウンロード

NGCCLIツールをインストールする。

wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/ngc-apps/ngc_cli/versions/3.35.0/files/ngccli_linux.zip -O ngccli_linux.zip && unzip ngccli_linux.zip

ダウンロードしてきたファイルのMD5とSHA256ハッシュを確認し、整合性をチェックする。

find ngc-cli/ -type f -exec md5sum {} + | LC_ALL=C sort | md5sum -c ngc-cli.md5
sha256sum ngccli_linux.zip

CLIツールを実行可能に設定しパスをシステムに追加する。

chmod u+x ngc-cli/ngc
echo "export PATH=\"\$PATH:$(pwd)/ngc-cli\"" >> ~/.bash_profile && source ~/.bash_profile

2. NGCの設定と認証

NGC CLIを使用する前にAPIキーとCLIの出力形式を設定する。

ngc config set

ここで、プロンプトに従ってAPIキー、出力形式(csv, ascii, json)、組織、チーム、エースなどの情報を入力。

3. データセットのダウンロードと前処理

Pileデータセットをダウンロードし、NGCのバッチCLIで前処理を行う。

ngc batch run --name "bignlp-dataprep-create-dataset" \
  --org nv-launchpad-bc \
  --team nvbc-bignlp \
  --ace nv-launchpad-bc-iad1 \
  --instance dgxa100.80g.8.norm \
  --result /results \
  --array-type "PYTORCH" \
  --replicas "2" \
  --image "nvcr.io/nv-launchpad-bc/bignlp-training:22.02-py3" \
  --workspace your_workspace_name:/mount_workspace:RW \
  --total-runtime 6h \
  --commandline "\
set -x && \
python3 /opt/bignlp/bignlp-scripts/main.py \
cluster_type=bcp \
run_data_preparation=True \
run_training=False \
run_conversion=False \
run_evaluation=False \
bignlp_path=/opt/bignlp/bignlp-scripts \
data_dir=/your_data_directory \
base_results_dir=/mount_workspace/results \
data_preparation.file_numbers='0-29' \
data_preparation
.vocab_save_dir=/mount_workspace/data/bpe
data_preparation.merges_save_dir=/mount_workspace/data/bpe"

約5.5時間で完了し、プロセスの進行状況はNGCのウェブUIまたはCLIで確認できる。
ジョブが完了すると、結果は自動的に指定したワークスペースディレクトリに保存される。