tomotwin-cryoet icon indicating copy to clipboard operation
tomotwin-cryoet copied to clipboard

Needs help even to reproduce tutorial

Open kimdn opened this issue 4 months ago • 2 comments

I installed TomoTwin with pip install tomotwin-cryoet

Then embedding

TomoTwin_model="/home/kimd999/brave/DN/model/TomoTwin/model/tomotwin_latest_2024_Sep.pth"
input_tomo="tomo/tomo.mrc"
batch_size="256"

# If you run into memory issues, reduce the batchsize (-b).
CUDA_VISIBLE_DEVICES=0,1 tomotwin_embed.py tomogram -m $TomoTwin_model -v $input_tomo -b $batch_size -o out/embed/tomo/ -s 2

worked well since I didn't see an obvious error during this embedding as

  Skip version check, as it failed with the following error:
  <urlopen error [Errno 101] Network is unreachable>
  ###############################################
  Found 2 GPU(s). Start DDP + Compiling.
  reading /home/kimd999/brave/DN/model/TomoTwin/model/tomotwin_latest_2024_Sep.pth
  reading /home/kimd999/brave/DN/model/TomoTwin/model/tomotwin_latest_2024_Sep.pth
  Model config:
  {'identifier': 'SiameseNet', 'network_config': {'output_channels': 32, 'dropout': 0.2, 'repeat_layers': 0, 'norm_name': 'GroupNor\
  m', 'norm_kwargs': {'num_groups': 64, 'num_channels': 1024}, 'gem_pooling_p': 0}, 'train_config': {'loss': 'TripletLoss', 'tl_mar\
  gin': 0.539, 'miner': True, 'miner_margin': 0.734, 'learning_rate': 5.945e-05, 'optimizer': 'Adam', 'weight_decay': 0, 'batchsize\
  ': 35, 'patience': 50, 'aug_train_shift_distance': 2}, 'distance': 'COSINE', 'window_size': (37, 37, 37)}
  Embeddings have shape: (5083356, 35)
  Wrote embeddings to disk to out/embed/tomo/tomo_embeddings.temb
  Done.
  Tomogram embedding completed in 0h:36m:9s.

However, generating umap with default n_neighbors tomotwin_tools.py umap -i $output_of_embedding -o $output_of_umap failed as

  RuntimeError: RAFT failure at file=/opt/conda/conda-bld/work/cpp/src/umap/knn_graph/algo.cuh line=115: n_neighbors should be smaller than the graph degree computed by nn descent
  Obtained 32 stack frames

Here (umap calculation), input file ($output_of_embedding) is tomo_embeddings.temb (output from embedding).

I know that default n_neighbors for TomoTwin umap is 200.

kimdn avatar Sep 30 '24 17:09 kimdn