|
1 | 1 | import gc |
2 | 2 | import logging |
| 3 | +import os |
3 | 4 | import time |
4 | 5 | from concurrent.futures import ProcessPoolExecutor, as_completed |
5 | 6 |
|
6 | 7 | import enlighten |
7 | | -import tensorflow as tf |
8 | 8 | from Bio.Seq import reverse_complement |
9 | 9 | from helperlibs.bio import seqio |
10 | 10 |
|
11 | 11 | from geneml.args import parse_args |
12 | 12 | from geneml.logger import setup_logger, write_setup_info |
13 | | -from geneml.model_loader import get_cached_gene_ml_model |
14 | 13 | from geneml.outputs import build_cds_sequences, build_prediction_scores_seg, write_fasta, write_gff_file |
15 | 14 | from geneml.parallelism import compute_optimal_num_parallelism |
16 | 15 | from geneml.params import Params, Strand, build_params_namedtuple |
@@ -89,6 +88,10 @@ def process_contig(contig_id: str, seq: str, params: Params, tensorflow_thread_c |
89 | 88 | """ |
90 | 89 | start_time = time.time() |
91 | 90 |
|
| 91 | + import tensorflow as tf |
| 92 | + |
| 93 | + from geneml.model_loader import get_cached_gene_ml_model |
| 94 | + |
92 | 95 | if params.cpu_only: |
93 | 96 | tf.config.set_visible_devices([], 'GPU') |
94 | 97 |
|
@@ -263,7 +266,8 @@ def main() -> None: |
263 | 266 | params = build_params_namedtuple(args) |
264 | 267 |
|
265 | 268 | if params.cpu_only: |
266 | | - tf.config.set_visible_devices([], 'GPU') |
| 269 | + os.environ['CUDA_VISIBLE_DEVICES'] = '-1' |
| 270 | + os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' |
267 | 271 |
|
268 | 272 | logfile = ''.join([params.basepath, '.log']) |
269 | 273 | setup_logger(logfile, debug = params.debug, verbose= params.verbose) |
|
0 commit comments