Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SENSE-PPI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Konstantin Volzhenin
SENSE-PPI
Commits
5b93c030
Commit
5b93c030
authored
Sep 18, 2023
by
Konstantin Volzhenin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.5.4 some model args and ESM2 args are suppressed
parent
86e49290
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
__init__.py
senseppi/__init__.py
+1
-1
esm2_model.py
senseppi/esm2_model.py
+8
-4
model.py
senseppi/model.py
+6
-4
network_utils.py
senseppi/network_utils.py
+1
-5
utils.py
senseppi/utils.py
+2
-1
No files found.
senseppi/__init__.py
View file @
5b93c030
__version__
=
"0.5.
3
"
__version__
=
"0.5.
4
"
__author__
=
"Konstantin Volzhenin"
from
.
import
model
,
commands
,
esm2_model
,
dataset
,
utils
,
network_utils
...
...
senseppi/esm2_model.py
View file @
5b93c030
#!/usr/bin/env python3 -u
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Modified by Konstantin Volzhenin, Sorbonne University, 2023
import
argparse
import
pathlib
...
...
@@ -20,8 +21,9 @@ def add_esm_args(parent_parser):
parser
.
add_argument
(
"--model_location_esm"
,
type
=
str
,
default
=
"esm2_t36_3B_UR50D"
,
help
=
"PyTorch model file OR name of pretrained model to download. If not default, "
"the number of encoder_features has to be modified according to the embedding dimensionality. "
# help="PyTorch model file OR name of pretrained model to download. If not default, "
# "the number of encoder_features has to be modified according to the embedding dimensionality. "
help
=
argparse
.
SUPPRESS
)
parser
.
add_argument
(
"--output_dir_esm"
,
...
...
@@ -35,13 +37,15 @@ def add_esm_args(parent_parser):
type
=
int
,
default
=
[
-
1
],
nargs
=
"+"
,
help
=
"layers indices from which to extract representations (0 to num_layers, inclusive)"
,
# help="layers indices from which to extract representations (0 to num_layers, inclusive)",
help
=
argparse
.
SUPPRESS
)
parser
.
add_argument
(
"--truncation_seq_length_esm"
,
type
=
int
,
default
=
1022
,
help
=
"truncate sequences longer than the given value"
,
# help="truncate sequences longer than the given value",
help
=
argparse
.
SUPPRESS
)
...
...
senseppi/model.py
View file @
5b93c030
import
argparse
import
torch
import
torch.nn.functional
as
F
from
torch.utils.data
import
DataLoader
import
pytorch_lightning
as
pl
import
torch.utils.data
as
data
from
torch.utils.data
import
Subset
from
torchmetrics
import
AUROC
,
ROC
,
Accuracy
,
Precision
,
Recall
,
F1Score
,
MatthewsCorrCoef
,
AveragePrecision
from
torchmetrics
import
AUROC
,
Accuracy
,
Precision
,
Recall
,
F1Score
,
MatthewsCorrCoef
,
AveragePrecision
from
torchmetrics.collections
import
MetricCollection
from
torch.nn.utils.rnn
import
pack_padded_sequence
,
pad_packed_sequence
import
torch.optim
as
optim
...
...
@@ -206,9 +207,10 @@ class BaselineModel(pl.LightningModule):
"Cosine warmup will be applied."
)
parser
.
add_argument
(
"--batch_size"
,
type
=
int
,
default
=
32
,
help
=
"Batch size for training/testing."
)
parser
.
add_argument
(
"--encoder_features"
,
type
=
int
,
default
=
2560
,
help
=
"Number of features in the encoder "
"(Corresponds to the dimentionality of per-token embedding of ESM2 model.) "
"If not a 3B version of ESM2 is chosen, this parameter needs to be set accordingly."
)
# help="Number of features in the encoder "
# "(Corresponds to the dimentionality of per-token embedding of ESM2 model.) "
# "If not a 3B version of ESM2 is chosen, this parameter needs to be set accordingly."
help
=
argparse
.
SUPPRESS
)
return
parent_parser
...
...
senseppi/network_utils.py
View file @
5b93c030
import
json
from
Bio
import
SeqIO
from
itertools
import
permutations
,
product
from
itertools
import
permutations
import
pandas
as
pd
import
numpy
as
np
import
os
import
urllib.request
import
time
from
tqdm
import
tqdm
from
copy
import
deepcopy
import
requests
import
gzip
import
shutil
...
...
senseppi/utils.py
View file @
5b93c030
...
...
@@ -15,7 +15,8 @@ def add_general_args(parser):
"considered and will be deleted from the fasta file."
)
parser
.
add_argument
(
"--device"
,
type
=
str
,
default
=
determine_device
(),
choices
=
[
'cpu'
,
'gpu'
,
'mps'
],
help
=
"Device to used for computations. Options include: cpu, gpu, mps (for MacOS)."
"If not selected the device is set by torch automatically."
)
"If not selected the device is set by torch automatically. WARNING: mps is temporarily "
"disabled, if it is chosen, cpu will be used instead."
)
return
parser
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment