#author("2025-04-12T19:16:25+00:00","default:sysosa","sysosa")
#author("2025-04-13T12:22:38+00:00;2025-04-12T19:16:25+00:00","default:sysosa","sysosa")
本家様 [[https://github.com/MPI-Dortmund/tomotwin-cryoet>+https://github.com/MPI-Dortmund/tomotwin-cryoet]]

Particle picking in Tomograms using triplet networks and metric learning


ここにインストール方法が記載されている
[[https://github.com/MPI-Dortmund/tomotwin-cryoet/blob/main/docs/installation.rst>+https://github.com/MPI-Dortmund/tomotwin-cryoet/blob/main/docs/installation.rst]]

読むとcondaの代わりにmambaを使ってねとあるが、パラレルでパッケージをダウンロードしてインストールは現行のcondaでも機能しているのでcondaのままでいいかなと..
っでconda環境を作ります. ここでは pyenvの上にanaconda3を敷いてcondaを使ってましてpyenv/anaconda環境が用意されてないなら
#code(nonumber){{
git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install anaconda3-2024.10-1
pyenv global anaconda3-2024.10-1
source /apps/pyenv/versions/anaconda3-2024.10-1/etc/profile.d/conda.sh
}}
として環境を作ります. 既に環境があるなら
#code(nonumber){{
source /apps/pyenv/versions/anaconda3-2024.10-1/etc/profile.d/conda.sh
}}
とPATHの定義を行います.

っでモノを作ります
#code(nonumber){{
[root@rockylinux9 ~]# cat /etc/redhat-release
Rocky Linux release 9.5 (Blue Onyx)

[root@rockylinux9 ~]# cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  570.133.07  Fri Mar 14 13:12:07 UTC 2025
GCC version:  gcc version 11.5.0 20240719 (Red Hat 11.5.0-2) (GCC)

[root@rockylinux9 ~]# nvidia-smi -L
GPU 0: NVIDIA GeForce GTX 1070 (UUID: GPU-a49de51b-de1e-52f3-1e3f-ce704e159713)

[root@rockylinux9 ~]#
}}
環境はこんな感じで nvidia ドライバー装備です

っで
#code(nonumber){{
[root@rockylinux9 ~]# conda env create -n tomotwin -f https://raw.githubusercontent.com/MPI-Dortmund/tomotwin-cryoet/main/conda_env_tomotwin.yml

[root@rockylinux9 ~]# conda activate tomotwin

(tomotwin) [root@rockylinux9 ~]# pip install tomotwin-cryoet

(tomotwin) [root@rockylinux9 ~]# conda deactivate

[root@rockylinux9 ~]# conda env create -n napari-tomotwin -f https://raw.githubusercontent.com/MPI-Dortmund/napari-tomotwin/main/conda_env.yml

[root@rockylinux9 ~]# conda activate napari-tomotwin

(napari-tomotwin) [root@rockylinux9 ~]# pip install napari-tomotwin

(napari-tomotwin) [root@rockylinux9 ~]# conda deactivate

[root@rockylinux9 ~]#
}}

ここまでで「tomotwin」と「napari-tomotwin」の実行環境が用意されました
#code(nonumber){{
[root@rockylinux9 src]# conda env list
# conda environments:
#
base                     /apps/pyenv/versions/anaconda3-2024.10-1
napari-tomotwin          /apps/pyenv/versions/anaconda3-2024.10-1/envs/napari-tomotwin
tomotwin                 /apps/pyenv/versions/anaconda3-2024.10-1/envs/tomotwin

[root@rockylinux9 src]#
}}

っで「tomotwin」実行環境から「napari-tomotwin」のnapari_boxmanagerを引けるようにlinkを貼ります
&size(10){内容的には crYOLO の napari_boxmanager と同じ};

#code(nonumber){{
[root@rockylinux9 ~]# source activate tomotwin
[root@rockylinux9 ~]# conda activate tomotwin

(tomotwin) [root@rockylinux9 ~]# tomotwin_dir=$(realpath $(dirname $(which tomotwin_embed.py)))
(tomotwin) [root@rockylinux9 ~]# echo $tomotwin_dir
/apps/pyenv/versions/anaconda3-2024.10-1/envs/tomotwin/bin

(tomotwin) [root@rockylinux9 ~]# napari_link_file=${tomotwin_dir}/napari_boxmanager
(tomotwin) [root@rockylinux9 ~]# echo $napari_link_file
/apps/pyenv/versions/anaconda3-2024.10-1/envs/tomotwin/bin/napari_boxmanager

(tomotwin) [root@rockylinux9 ~]# conda deactivate
[root@rockylinux9 ~]#


[root@rockylinux9 ~]# conda activate napari-tomotwin
(napari-tomotwin) [root@rockylinux9 ~]# echo -e "#\!/usr/bin/bash\nexport NAPARI_EXE=$(which napari)\nnapari_exe='$(which napari_boxmanager)'\n\${napari_exe} \"\${@}\""> ${napari_link_file}
(napari-tomotwin) [root@rockylinux9 ~]# cat $napari_link_file
#\!/usr/bin/bash
export NAPARI_EXE=/apps/pyenv/versions/anaconda3-2023.03/envs/napari-tomotwin/bin/napari
napari_exe='/apps/pyenv/versions/anaconda3-2023.03/envs/napari-tomotwin/bin/napari_boxmanager'
${napari_exe} "${@}"

(napari-tomotwin) [root@rockylinux9 ~]# ln -rs $(which napari) ${tomotwin_dir}
(napari-tomotwin) [root@rockylinux9 ~]# chmod +x ${napari_link_file}

(napari-tomotwin) [root@rockylinux9 ~]# conda deactivate
[root@rockylinux9 ~]#
}}


あと
#code(nonumber){{
[root@rockylinux9 ~]# mkdir /apps/tomotwin-cryoet
[root@rockylinux9 ~]# cd /apps/tomotwin-cryoet
[root@rockylinux9 tomotwin-cryoet]# wget https://ftp.gwdg.de/pub/misc/sphire/TomoTwin/models/tomotwin_model_p120_052022_loss.pth
}}


***environment-modules [#i50917fb]

#code(nonumber){{
[root@rockylinux9 ~]# vi /apps/modulefiles/tomotwin
#%Module1.0
set          root /apps/pyenv/versions/anaconda3-2024.10-1/envs/tomotwin
prepend-path PATH $root/bin

[root@rockylinux9 ~]#
}}



***memo [#gefdc8ee]

インストールドキュメントには
#code(nonumber){{
mamba create -n tomotwin -c pytorch -c rapidsai -c nvidia -c conda-forge python=3.10 pytorch==1.13.1 torchvision pandas scipy numpy \
  matplotlib pytables cuML=23.04 cudatoolkit=11.8 'protobuf>3.20' tensorboard  optuna mysql-connector-python
}}
とあるのだが、gitで取得したものには

#code(yaml,nonumber){{
name: tomotwin
channels:
  - conda-forge
  - pytorch
  - rapidsai
  - nvidia
  - defaults
dependencies:
  - pytorch==1.13.1
  - torchvision
  - pandas[version='<2']
  - scipy
  - numpy
  - matplotlib
  - pytables
  - cuml=23.04
  - cudatoolkit=11.8
  - protobuf[version='>3.20']
  - tensorboard
  - optuna
  - mysql-connector-python
}}




とある
1

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS