Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 5, 2024
1 parent f565d52 commit 23d9f63
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 30 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""

from setuptools import setup

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions src/grelu/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
All dataset classes produce either one-hot encoded sequences of shape (4, L)
or sequence-label pairs of shape (4, L) and (T, L).
"""

import os
from typing import Callable, List, Optional, Sequence, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions src/grelu/data/preprocess.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions to preprocess genomic datasets.
"""

import os
import subprocess
import tempfile
Expand Down
1 change: 1 addition & 0 deletions src/grelu/data/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Dataset-related utility functions.
"""

from typing import List, Union

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions src/grelu/interpret/score.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions related to scoring the importance of individual DNA bases.
"""

import os
import warnings
from typing import Callable, List, Optional, Union
Expand Down
60 changes: 30 additions & 30 deletions src/grelu/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,38 +78,38 @@ def update_ckpt(ckpt_file: str, out_file: Optional[str] = None) -> None:
}

for i in range(6):
keys_dict[
f"model.conv_tower.{i}.0.0"
] = f"model.embedding.conv_tower.blocks.{i+1}.0.norm.layer"
keys_dict[
f"model.conv_tower.{i}.0.2"
] = f"model.embedding.conv_tower.blocks.{i+1}.0.conv"
keys_dict[
f"model.conv_tower.{i}.1.fn.0"
] = f"model.embedding.conv_tower.blocks.{i+1}.1.norm.layer"
keys_dict[
f"model.conv_tower.{i}.1.fn.2"
] = f"model.embedding.conv_tower.blocks.{i+1}.1.conv"
keys_dict[
f"model.conv_tower.{i}.2"
] = f"model.embedding.conv_tower.blocks.{i+1}.1.pool.layer"
keys_dict[f"model.conv_tower.{i}.0.0"] = (
f"model.embedding.conv_tower.blocks.{i+1}.0.norm.layer"
)
keys_dict[f"model.conv_tower.{i}.0.2"] = (
f"model.embedding.conv_tower.blocks.{i+1}.0.conv"
)
keys_dict[f"model.conv_tower.{i}.1.fn.0"] = (
f"model.embedding.conv_tower.blocks.{i+1}.1.norm.layer"
)
keys_dict[f"model.conv_tower.{i}.1.fn.2"] = (
f"model.embedding.conv_tower.blocks.{i+1}.1.conv"
)
keys_dict[f"model.conv_tower.{i}.2"] = (
f"model.embedding.conv_tower.blocks.{i+1}.1.pool.layer"
)

for i in range(ckpt["hyper_parameters"]["model_params"]["n_transformers"]):
keys_dict[
f"model.transformer.{i}.0.fn.0"
] = f"model.embedding.transformer_tower.blocks.{i}.norm.layer"
keys_dict[
f"model.transformer.{i}.0.fn.1"
] = f"model.embedding.transformer_tower.blocks.{i}.mha"
keys_dict[
f"model.transformer.{i}.1.fn.0"
] = f"model.embedding.transformer_tower.blocks.{i}.ffn.dense1.norm.layer"
keys_dict[
f"model.transformer.{i}.1.fn.1"
] = f"model.embedding.transformer_tower.blocks.{i}.ffn.dense1.linear"
keys_dict[
f"model.transformer.{i}.1.fn.4"
] = f"model.embedding.transformer_tower.blocks.{i}.ffn.dense2.linear"
keys_dict[f"model.transformer.{i}.0.fn.0"] = (
f"model.embedding.transformer_tower.blocks.{i}.norm.layer"
)
keys_dict[f"model.transformer.{i}.0.fn.1"] = (
f"model.embedding.transformer_tower.blocks.{i}.mha"
)
keys_dict[f"model.transformer.{i}.1.fn.0"] = (
f"model.embedding.transformer_tower.blocks.{i}.ffn.dense1.norm.layer"
)
keys_dict[f"model.transformer.{i}.1.fn.1"] = (
f"model.embedding.transformer_tower.blocks.{i}.ffn.dense1.linear"
)
keys_dict[f"model.transformer.{i}.1.fn.4"] = (
f"model.embedding.transformer_tower.blocks.{i}.ffn.dense2.linear"
)

# Make new state dict in which old names are replaced by new ones
new_state_dict = OrderedDict()
Expand Down
1 change: 1 addition & 0 deletions src/grelu/io/fasta.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions related to reading and writing FASTA files
"""

import gzip
import os
from typing import List
Expand Down
1 change: 1 addition & 0 deletions src/grelu/io/genome.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions for loading genomes and related annotation files
"""

import os
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions src/grelu/io/meme.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions related to reading and writing MEME files
"""

import os
from typing import List, Optional

Expand Down
1 change: 1 addition & 0 deletions src/grelu/lightning/losses.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Custom loss functions
"""

import torch
import torch.nn.functional as F
from torch import Tensor, nn
Expand Down
1 change: 1 addition & 0 deletions src/grelu/model/layers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Commonly used layers to build deep learning models.
"""

from typing import Optional

import torch
Expand Down
1 change: 1 addition & 0 deletions src/grelu/model/position.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions to generate positional encodings.
"""

import math

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/grelu/model/trunks/borzoi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The Borzoi model architecture and its required classes.
"""

from enformer_pytorch.modeling_enformer import exponential_linspace_int
from torch import Tensor, nn

Expand Down
1 change: 1 addition & 0 deletions src/grelu/model/trunks/enformer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The Enformer model architecture and its required classes
"""

import torch
from einops import rearrange
from enformer_pytorch.modeling_enformer import Attention, exponential_linspace_int
Expand Down
1 change: 1 addition & 0 deletions src/grelu/sequence/metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions to calculate metrics based on the content of a sequence
"""

from typing import List, Optional, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/grelu/sequence/mutate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions to mutate or alter DNA sequences in various ways.
"""

from typing import List, Optional, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/grelu/transforms/label_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The input to the forward method is assumed to be a numpy array of shape (N, T, L)
"""

from typing import Callable, Optional, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/grelu/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
General utility functions
"""

from typing import Callable, Optional, Sequence, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/grelu/variant.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module provides functions to filter and process genetic variants.
"""

import warnings
from typing import Callable, List, Optional, Tuple, Union

Expand Down

0 comments on commit 23d9f63

Please sign in to comment.