Running selene wih the original deepSEA model

22 views
Skip to first unread message

Marcel Mück

unread,
Nov 29, 2023, 3:56:49 AM11/29/23
to Selene (sequence-based deep learning package)
Hello everybody,
I was going through the instructions in `tutorials/variants_and_visualizations/selene_variants_and_vis_tutorial/variants_and_visualizations.ipynb`. In there, variant effects are predicted from a vcf file using the example `DeeperDeepSEA` model. I was now trying to get the same effect prediction to run on the model from the original deepSEA paper (Jian Zhou, Olga G. Troyanskaya 2015). For this I used the model architecture from 'https://github.com/FunctionLab/selene/blob/master/models/deepsea.py' as well as the model weights from the original paper (https://zenodo.org/records/1466993/files/deepsea_predict.pth). However, the model weights seemed to be incompatible. When I run
```
model_predict = AnalyzeSequences(
    NonStrandSpecific(DeepSEA(1000,919)),
    "deepsea_predict.pth",
    sequence_length=1000,
    features=distinct_features,
    reference_sequence=Genome("hg38.fa"),
    use_cuda=False  # update this to False if you do not have CUDA on your machine.
)
```
I get
```
RuntimeError
Error(s) in loading state_dict for NonStrandSpecific: 
size mismatch for model.conv_net.0.weight: copying a param with shape torch.Size([320, 4, 1, 8]) from checkpoint, the shape in current model is torch.Size([320, 4, 8]). 
size mismatch for model.conv_net.4.weight: copying a param with shape torch.Size([480, 320, 1, 8]) from checkpoint, the shape in current model is torch.Size([480, 320, 8]). 
size mismatch for model.conv_net.8.weight: copying a param with shape torch.Size([960, 480, 1, 8]) from checkpoint, the shape in current model is torch.Size([960, 480, 8]).
 size mismatch for model.classifier.0.weight: copying a param with shape torch.Size([925, 50880]) from checkpoint, the shape in current model is torch.Size([919, 50880]). 
size mismatch for model.classifier.0.bias: copying a param with shape torch.Size([925]) from checkpoint, the shape in current model is torch.Size([919]). 
size mismatch for model.classifier.2.weight: copying a param with shape torch.Size([919, 925]) from checkpoint, the shape in current model is torch.Size([919, 919]).
```
So the dimensions seem to be off. Did anyone have any idea how I could get selene to run on the original deepSEA model or did anyone run into similar problems?

Thank you and regards
Marcel Mück from DKFZ (German Cancer research Centre)
Reply all
Reply to author
Forward
0 new messages