From 852ee3c8fcaa3ba741b8871bccdecee812136403 Mon Sep 17 00:00:00 2001 From: Svetlana Kutuzova Date: Wed, 18 Sep 2024 17:05:34 +0200 Subject: [PATCH] fix: cuda utilization --- .github/workflows/cli_vamb.yml | 6 +++--- vamb/__main__.py | 11 +---------- vamb/taxvamb_encode.py | 6 +++--- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cli_vamb.yml b/.github/workflows/cli_vamb.yml index 70164add..1f74ae2a 100644 --- a/.github/workflows/cli_vamb.yml +++ b/.github/workflows/cli_vamb.yml @@ -42,7 +42,7 @@ jobs: cat outdir_vamb/log.txt - name: Run TaxVAMB run: | - vamb bin taxvamb --outdir outdir_taxvamb --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy taxonomy_mock.tsv -pe 10 -pt 10 -e 10 -q -pq -t 10 -o C --minfasta 200000 + vamb bin taxvamb --outdir outdir_taxvamb --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy taxonomy_mock.tsv -pe 10 -pt 10 -e 10 -q -t 10 -o C --minfasta 200000 ls -la outdir_taxvamb cat outdir_taxvamb/log.txt vamb bin taxvamb --outdir outdir_taxvamb_no_predict --no_predictor --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy taxonomy_mock.tsv -e 10 -q -t 10 -o C --minfasta 200000 @@ -53,10 +53,10 @@ jobs: cat outdir_taxvamb_preds/log.txt - name: Run Taxometer run: | - vamb taxometer --outdir outdir_taxometer --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy taxonomy_mock.tsv -pe 10 -pq -pt 10 + vamb taxometer --outdir outdir_taxometer --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy taxonomy_mock.tsv -pe 10 -pt 10 ls -la outdir_taxometer cat outdir_taxometer/log.txt - vamb taxometer --outdir outdir_taxometer_pred --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy outdir_taxometer/results_taxometer.tsv -pe 10 -pq -pt 10 + vamb taxometer --outdir outdir_taxometer_pred --fasta catalogue_mock.fna.gz --abundance abundance_mock.npz --taxonomy outdir_taxometer/results_taxometer.tsv -pe 10 -pt 10 ls -la outdir_taxometer_pred cat outdir_taxometer/log.txt - name: Run k-means reclustering diff --git a/vamb/__main__.py b/vamb/__main__.py index 7ea45582..d05863d2 100755 --- a/vamb/__main__.py +++ b/vamb/__main__.py @@ -240,7 +240,7 @@ def from_args_taxometer(cls, args: argparse.Namespace): return cls( typeasserted(args.pred_nepochs, int), typeasserted(args.pred_batchsize, int), - typeasserted(args.pred_batchsteps, list), + [], ) def __init__( @@ -1857,15 +1857,6 @@ def add_predictor_arguments(subparser): default=1024, help=argparse.SUPPRESS, ) - pred_trainos.add_argument( - "-pq", - dest="pred_batchsteps", - metavar="", - type=int, - nargs="*", - default=[], - help=argparse.SUPPRESS, - ) pred_trainos.add_argument( "-pthr", dest="pred_softmax_threshold", diff --git a/vamb/taxvamb_encode.py b/vamb/taxvamb_encode.py index 9cc8d210..79ea5333 100644 --- a/vamb/taxvamb_encode.py +++ b/vamb/taxvamb_encode.py @@ -824,9 +824,6 @@ def __init__( self.tree = _hloss.Hierarchy(table_parent) self.n_tree_nodes = nlabels - if cuda: - self.cuda() - self.nodes = nodes self.table_parent = table_parent self.hierloss = init_hier_loss(hier_loss, self.tree) @@ -855,6 +852,9 @@ def __init__( self.relu = _nn.LeakyReLU() self.dropoutlayer = _nn.Dropout(p=self.dropout) + if cuda: + self.cuda() + def _predict(self, tensor: Tensor) -> tuple[Tensor, Tensor]: tensors: list[_torch.Tensor] = list()