Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkobject committed Aug 10, 2024
1 parent 46f3e13 commit 3161bd5
Show file tree
Hide file tree
Showing 18 changed files with 449 additions and 1,229 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ data/main/embeddings.parquet
slurm-*.out
notebooks/tests/step_0_.h5ad
data/main/gene_embeddings.parquet
*.h5ad
data/main/main_scenic+.parquet
scdataloader.out
data/main/9606.protein.links.v12.0.txt.gz
Expand All @@ -170,3 +169,8 @@ lightning_logs/
collator_output.txt
data/bias_sparse.npz
todel/
tests/*.ckpt
tests/out_*.h5ad
data/*.h5ad
notebooks/**/*.h5ad
notebooks/*.h5ad
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ install: ## Install the project in dev mode.
.PHONY: fmt
fmt: ## Format code using black & isort.
$(ENV_PREFIX)isort scprint/
$(ENV_PREFIX)black -l 79 scprint/
$(ENV_PREFIX)black -l 79 tests/
$(ENV_PREFIX)black -l 110 scprint/
$(ENV_PREFIX)black -l 110 tests/

.PHONY: lint
lint: ## Run pep8, black, mypy linters.
$(ENV_PREFIX)flake8 scprint/
$(ENV_PREFIX)black -l 79 --check scprint/
$(ENV_PREFIX)black -l 79 --check tests/
$(ENV_PREFIX)mypy --ignore-missing-imports scprint/
$(ENV_PREFIX)flake8 --ignore=E501,E203,E266,E265,W503 scprint/
$(ENV_PREFIX)black -l 120 --check scprint/
$(ENV_PREFIX)black -l 120 --check tests/

.PHONY: test
test: lint ## Run tests and generate coverage report.
Expand Down
3 changes: 1 addition & 2 deletions scprint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,10 @@ def _run_subcommand(self, subcommand: str) -> None:
preprocessor = Preprocessor(
do_postp=False,
force_preprocess=True,
skip_validate=True,
use_layer="counts",
)
adata = preprocessor(adata)
conf = dict(self.config_init[subcommand])

model = scPrint.load_from_checkpoint(
self.config_init[subcommand]["ckpt_path"], precpt_gene_emb=None
)
Expand Down
227 changes: 0 additions & 227 deletions scprint/explainer/explainer.py

This file was deleted.

3 changes: 0 additions & 3 deletions scprint/model/flash_attn/activations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Copied from https://github.com/mlcommons/training_results_v1.1/blob/main/NVIDIA/benchmarks/bert/implementations/pytorch/model/layers/activations.py
import math

import torch
import torch.nn as nn
import torch.nn.functional as F

# 1/sqrt(2*pi)-> 0.3989423
Expand Down
1 change: 0 additions & 1 deletion scprint/model/flash_attn/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torchvision.ops import StochasticDepth

Expand Down
2 changes: 0 additions & 2 deletions scprint/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
from torch import Tensor, optim, nn
from lightning.pytorch.tuner.lr_finder import _LRCallback
from lightning.pytorch.callbacks.lr_finder import LearningRateFinder
import torch.distributed as dist
import torch
from galore_torch import GaLoreAdamW
from math import factorial
import lightning as L
import os
import numpy as np
import copy
from scipy.sparse import load_npz
from huggingface_hub import PyTorchModelHubMixin
Expand Down
4 changes: 0 additions & 4 deletions scprint/tasks/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
from scdataloader.data import SimpleAnnDataset
from scdataloader import Collator, Preprocessor
from scprint.model import utils
from scprint.tasks import compute_corr

import bionty as bt
from torch.utils.data import DataLoader
import sklearn.metrics
import pandas as pd

from lightning.pytorch import Trainer
import anndata as ad
from anndata import AnnData

Expand Down
Loading

0 comments on commit 3161bd5

Please sign in to comment.