sintel-dev / Orion

Library for detecting anomalies in signals
https://sintel.dev/Orion/
MIT License
1.05k stars 162 forks source link

How to run AtaGAN on a GPU #297

Closed xuchunyu123 closed 2 years ago

xuchunyu123 commented 2 years ago

Description

Module Not Found Error: No module named ‘tensorflow.contrib

What I Did

This error is located to cudnn_recurrent.py this file before:from tensorflow .contrib.cudnn_rnn.python.ops import cudnn_rnn_ops self._cudnn_lstm= cudnn_rnn_ops.CuDNNLSTM after: import tensorflow as tf self._cudnn_lstm=tf.compat.v1.keras.layers.CuDNNLSTM

File "D:/xcy/anomaly-detection/try.py", line 58, in <module>
    anomalies = orion.fit_detect(df)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\orion\core.py", line 184, in fit_detect
    result = self._detect(self._mlpipeline.fit, data, visualization, **kwargs)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\orion\core.py", line 113, in _detect
    outputs = method(data, output_=outputs_spec, **kwargs)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\mlblocks\mlpipeline.py", line 649, in fit
    self._fit_block(block, block_name, context)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\mlblocks\mlpipeline.py", line 549, in _fit_block
    block.fit(**fit_args)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\mlblocks\mlblock.py", line 302, in fit
    getattr(self.instance, self.fit_method)(**fit_kwargs)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\orion\primitives\tadgan.py", line 292, in fit
    self._build_tadgan(**kwargs)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\orion\primitives\tadgan.py", line 177, in _build_tadgan
    self.encoder_input_shape)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\orion\primitives\tadgan.py", line 110, in _build_model
    return Model(x, model(x))
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\engine\base_layer.py", line 463, in __call__
    self.build(unpack_singleton(input_shapes))
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\engine\sequential.py", line 222, in build
    x = layer(x)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\layers\wrappers.py", line 437, in __call__
    return super(Bidirectional, self).__call__(inputs, **kwargs)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\engine\base_layer.py", line 463, in __call__
    self.build(unpack_singleton(input_shapes))
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\layers\wrappers.py", line 581, in build
    self.forward_layer.build(input_shape)
  File "E:\anaconda\envs\xcy_torchcuda\lib\site-packages\keras\layers\cudnn_recurrent.py", line 435, in build
    input_mode='linear_input')
TypeError: __init__() missing 1 required positional argument: 'units'

I would be very grateful if you could help me

sarahmish commented 2 years ago

Hi @xuchunyu123, I have never personally encountered this error but I would generally assert that you have the proper TF, CUDA, and CuDNN versions.

The exact configuration of CUDA depends on your system. Here are some resources to guide you through the setup https://www.tensorflow.org/install/gpu and https://www.tensorflow.org/install/source#gpu. Also keep in mind that Orion is currently using tensorflow 1. My personal setup is to have tensorflow==1.14 and tensorflow-gpu==1.14 with CUDA 10.0.

If you still have errors, please share the code snippet you used such that I can try to reproduce this! Hope this helps!