biocore / songbird

Vanilla regression methods for microbiome differential abundance analysis
BSD 3-Clause "New" or "Revised" License
54 stars 25 forks source link

Songbird tensorflow error #152

Closed JGADuBose closed 2 years ago

JGADuBose commented 3 years ago

Hello. I have been trying to use Songbird for some differential abundance analyses, but I have been unable to get it to work. I have tried running it through the QIIME2 plug-in on qiime2-2019.7, qiime2-2019.10, and qiime2-2020.6. I have also attempted to run it through an independent songbird environment. I have posted the error I get from the QIIME2 plug-in, but the error I get when running the independent version is similar.

Plugin error from songbird:

num_classes should be positive, got 0 [[node multinomial/Multinomial (defined at /home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for 'multinomial/Multinomial': File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/bin/qiime", line 11, in sys.exit(qiime()) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(args, kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/q2cli/commands.py", line 329, in call results = action(arguments) File "", line 2, in multinomial File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable output_types, provenance) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/qiime2/sdk/action.py", line 390, in _callableexecutor output_views = self._callable(view_args) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/songbird/q2/_method.py", line 63, in multinomial model(session, trainX, trainY, testX, testY) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/songbird/multinomial.py", line 70, in call batch_ids = tf.multinomial(tf.ones([1, self.N]), self.batch_size) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 324, in new_func return func(*args, *kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/random_ops.py", line 361, in multinomial return multinomial_categorical_impl(logits, num_samples, output_dtype, seed) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/random_ops.py", line 397, in multinomial_categorical_impl logits, num_samples, seed=seed1, seed2=seed2, output_dtype=dtype) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_random_ops.py", line 85, in multinomial seed2=seed2, output_dtype=output_dtype, name=name) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func return func(args, kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op attrs, op_def, compute_device) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal op_def=op_def) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

I have a collaborator who has also attempted to run the stand-alone Songbird, and he has received the following error: ModuleNotFoundError: No module named 'tensorflow.python.types

I have tried adjusting the --min-feature-count and the --min-sample-count so that samples would not be filtered as strictly, just incase the problem was an empty dataset. However, that does not seem to be the issue.

Any advice or help would be greatly appreciated. I am a relatively experienced QIIME2 user. However, this is my first time using Songbird. I noticed that a comment that has stated that tensorflow will be ditched in the next update (which I suspect is the source of our issues), and that this update is in development, so I hope this post doesn't sound pushy or redundant. I'm relatively new to the community and am still figuring a lot of things out. Any insight would be appreciated.

Thank you!

mortonjt commented 3 years ago

What version of TF are you using? Chances you have TF=2, which is a no go.

You can verify with python -c 'import tensorflow; print(tensorflow.__version__)'

On Sun, Mar 14, 2021 at 1:47 PM JGADuBose @.***> wrote:

Hello. I have been trying to use Songbird for some differential abundance analyses, but I have been unable to get it to work. I have tried running it through the QIIME2 plug-in on qiime2-2019.7, qiime2-2019.10, and qiime2-2020.6. I have also attempted to run it through an independent songbird environment. I have posted the error I get from the QIIME2 plug-in, but the error I get when running the independent version is similar.

**Plugin error from songbird:

num_classes should be positive, got 0 [[node multinomial/Multinomial (defined at /home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for 'multinomial/Multinomial': File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/bin/qiime", line 11, in sys.exit(qiime()) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(args, kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/q2cli/commands.py", line 329, in call results = action(arguments) File "", line 2, in multinomial File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable output_types, provenance) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/qiime2/sdk/action.py", line 390, in callable_executor output_views = self._callable(*view_args) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/songbird/q2/_method.py", line 63, in multinomial model(session, trainX, trainY, testX, testY) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/songbird/multinomial.py", line 70, in call batch_ids = tf.multinomial(tf.ones([1, self.N]), self.batch_size) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 324, in new_func return func(args, *kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/random_ops.py", line 361, in multinomial return multinomial_categorical_impl(logits, num_samples, output_dtype, seed) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/random_ops.py", line 397, in multinomial_categorical_impl logits, num_samples, seed=seed1, seed2=seed2, output_dtype=dtype) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_random_ops.py", line 85, in multinomial seed2=seed2, output_dtype=output_dtype, name=name) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func return func(args,

kwargs) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op attrs, op_def, compute_device) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal op_def=op_def) File "/home/jdubose3/miniconda2/envs/qiime2-2020.6/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

I have a collaborator who has also attempted to run the stand-alone Songbird, and he has received the following error: ModuleNotFoundError: No module named 'tensorflow.python.types

I have tried adjusting the --min-feature-count and the --min-sample-count so that samples would not be filtered as strictly, just incase the problem was an empty dataset. However, that does not seem to be the issue.

Any advice or help would be greatly appreciated. I am a relatively experienced QIIME2 user. However, this is my first time using Songbird. I noticed that a comment that has stated that tensorflow will be ditched in the next update (which I suspect is the source of our issues), and that this update is in development, so I hope this post doesn't sound pushy or redundant. I'm relatively new to the community and am still figuring a lot of things out. Any insight would be appreciated.

Thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/biocore/songbird/issues/152, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA75VXIP6VD3DEFULRTD65DTDUHEHANCNFSM4ZFJY2BQ .

JGADuBose commented 3 years ago

Sorry, I forgot to specify one more thing that I tired. I noticed a previous error saying that the version was not compatible with my version of tensorflow (2.someting), so I installed the listed compatible tensorflow version (1.5.something I believe), and it did not work. It provided a range of compatible tensorflow versions and I tried a few of them. Sorry for the lack of specificity. I am not currently at my working computer.

mortonjt commented 3 years ago

hmm, ok after reading your error more carefully, the key here is num_classes should be positive, got 0. So you were able to install it correctly. No idea what is going on with your collaborator, best to open a separate issue for that.

What does your metadata look like? Is there a chance that you are feeding in NaNs?

On Sun, Mar 14, 2021 at 3:02 PM JGADuBose @.***> wrote:

Sorry, I forgot to specify one more thing that I tired. I noticed a previous error saying that the version was not compatible with my version of tensorflow (2.someting), so I installed the listed compatible tensorflow version (1.5.something I believe), and it did not work. It provided a range of compatible tensorflow versions and I tried a few of them. Sorry for the lack of specificity. I am not currently at my working computer.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/biocore/songbird/issues/152#issuecomment-798979177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA75VXK6OD7CQH2JODVRXETTDUP57ANCNFSM4ZFJY2BQ .

mortonjt commented 3 years ago

@JGADuBose any luck with this?

JGADuBose commented 3 years ago

I apologize for the delayed response. I do not believe my metadata has any issues with it. I am somewhat new to this however. I removed the qiime2 comment lines and what not. I will attach my data below. PA1Metadata.txt

mortonjt commented 2 years ago

Hi @JGADuBose I'm going to close this issue. If you still have problems, feel free to reopen.