$ git-lfs clone https://huggingface.co/bert-base-uncased # 日本語の場合 $ git-lfs clone https://huggingface.co/tohoku-nlp/bert-base-japanese-v3
参考ページ
qiita.com
Python プログラムが Kill されたので メモリサイズを増やす
デフォルトでは 物理メモリの半分だった
C:\Users\hoge\.wslconfig [wsl2] memory=56GB swap=0
$ free -h total used free shared buff/cache available Mem: 54Gi 519Mi 53Gi 3.0Mi 549Mi 53Gi Swap: 0B 0B 0B
$ sudo vi /etc/wsl.conf [network] hostname = WSL
Dockerfileの作成
$ vi Dockerfile # python バージョン:3.7.6 FROM python:3.7.6 # 作業ディレクトリ WORKDIR /code # 作業ディレクトリをコンテナにコピー COPY ./code /code # pip アップグレード RUN pip install --upgrade pip # requirements.txt はコンテナにコピーして実行 COPY requirements.txt . RUN pip install -r requirements.txt
requirements.txt の作成
$ vi requirements.txt numpy pandas matplotlib seaborn scikit-learn
イメージの作成
$ docker image build -t python376 . $ docker images
起動
$ docker run -it -v ./code:/code python376 bash
イメージの一覧
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE nvcr.io/nvidia/pytorch 24.02-py3 91fc76da3ebc 3 weeks ago 22.2GB hello-world latest d2c94e258dcb 10 months ago 13.3kB nvcr.io/nvidia/pytorch 22.04-py3 6884f16521ea 22 months ago 14.1GB
イメージの削除
$ docker rmi 91fc76da3ebc $ docker rmi 91fc76da3ebc Untagged: nvcr.io/nvidia/pytorch:24.02-py3 Untagged: nvcr.io/nvidia/pytorch@sha256:69c54ea51853c57b1f5abae7878a64b238fb10c177855e1c6521d7ab87fad2eb ・・・ Deleted: sha256:1a102d1cac2bdae8a0160ac4365d4f8653e9d6da56c793a665d556ae07fb7f82 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest d2c94e258dcb 10 months ago 13.3kB nvcr.io/nvidia/pytorch 22.04-py3 6884f16521ea 22 months ago 14.1GB
起動
$ docker run --gpus all -h pytorch -it --rm -v /home/hoge:/home/hoge nvcr.io/nvidia/pytorch:22.04-py3
起動済みのDockerでsshを動かす
# apt-get update # apt-get install -y openssh-server # vi /etc/ssh/sshd_config PasswordAuthentication yes # /etc/init.d/ssh start # /etc/init.d/ssh status # ユーザ追加 ← ホストOSのユーザ名、ユーザID、グループIDと合わせる # groupadd -g 1000 hoge # useradd -m -s /bin/bash -u 1000 -g 1000 hoge # passwd hoge # hostname -I 172.17.0.2
インストールされているディストリビューション
wsl -l -v
ディストリビューションの削除
wsl --unregister Ubuntu-22.04
インストールできるディストリビューション
wsl --list --online
ディストリビューションを指定してインストール
wsl --install -d Ubuntu-22.04
ディストリビューションを指定して起動
wsl -d Ubuntu-22.04
停止
wsl --shutdown
デフォルトのディストリビューションを設定
wsl --set-default Ubuntu-22.04
ディストリビューションをバックアップ
wsl --export <ディストリビューション名>
wsl --import <新しいディストリビューション名> <インストールするフォルダ名>
Ubuntu のアップデート
$ sudo apt-get update Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease ... Reading package lists... Done
前提パッケージをインストール
$ sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
Dockerの公式GPG公開鍵のインストール
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
公開鍵のフィンガープリントを確認
$ sudo apt-key fingerprint 0EBFCD88
repositoryの追加
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
インストール可能なパッケージの一覧を更新
$ sudo apt-get update
Docker CE のインストール
$ sudo apt-get install -y docker-ce
sudoを付加しなくていいように
# dockerグループの情報表示 $ getent group docker # Dockerグループにユーザ追加 $ sudo gpasswd -a [username] docker # 権限を付与 $ sudo chgrp docker /var/run/docker.sock # 追加されているか確認 $ id [username] # 再起動 $ sudo reboot
テスト
$ sudo docker run hello-world