MicrobeLab / DeepMicrobes

DeepMicrobes: taxonomic classification for metagenomics with deep learning
https://doi.org/10.1093/nargab/lqaa009
Apache License 2.0
81 stars 21 forks source link

AttributeError: module 'tensorflow' has no attribute 'logging'. Did you mean: '_logging'? - issue while creating tfrec #31

Open Gayathri142 opened 6 months ago

Gayathri142 commented 6 months ago

I am trying to convert my reference fasta to TFrec file for training, following instructions on: https://github.com/MicrobeLab/DeepMicrobes/blob/master/document/tfrecord.md

It is able to shuffle the sequences, split but when the conversion starts I get this error. Could you please help me in this regard?

  1. Shuffling sequences for training... (echo -n ">"; cat <&0) | sed "s/^>/\x0>/"

  2. Splitting input to 20480000 sequences per file...

======================================

  1. Converting to TFRecord... defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 119. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 585. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 631. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 632. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 633. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 666. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 1541. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 1547. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /DeepMicrobes/DeepMicrobes/bin/parallel line 1553. (Maybe you should just omit the defined()?) 2023-12-11 10:10:56.981597: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used. 2023-12-11 10:10:57.033642: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2023-12-11 10:10:57.033709: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2023-12-11 10:10:57.035517: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2023-12-11 10:10:57.045672: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used. 2023-12-11 10:10:57.045963: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-12-11 10:11:02.224734: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "/DeepMicrobes/DeepMicrobes/scripts/seq2tfrec_kmer.py", line 239, in tf.logging.set_verbosity(tf.logging.INFO) ^^^^^^^^^^ AttributeError: module 'tensorflow' has no attribute 'logging'. Did you mean: '_logging'? cat: subset.tfrec: No such file or directory rm: cannot remove ‘subset.tfrec’: No such file or directory Finished.
MicrobeLab commented 6 months ago

In TensorFlow 2.0, the tf.logging module has been removed in favor of the open-source absl-py. To set the logging verbosity in TensorFlow 2.0 and later, you can use the absl logging methods:

import absl.logging absl.logging.set_verbosity(absl.logging.INFO)

The code was written in TF1. You could either modify the code accordingly or just remove the line of code.