Unexpected keyword argument 'show_dtype' - tensorflow

I am trying to plot my model with the data types with the following the code:
plot_model(model, to_file='model/model.png', show_dtype=True, show_shapes=True, show_layer_names=True)
However, I get an error that show_dtype is not an acceptable parameter even though it appears on the TensorFlow documentation: https://www.tensorflow.org/api_docs/python/tf/keras/utils/plot_model

This is the first time that I have run into this issue. It seems that this may be due to having an earlier release if you downloaded it from Anaconda Forge rather than something else like Pip. It is a simple fix, however.
Basically, you need to go into the library source file and edit it to the current version that is shown on the TensorFlow documentation page.
The link to the GitHub page that you will copy the Python code from is here: https://github.com/tensorflow/tensorflow/blob/v2.5.0/tensorflow/python/keras/utils/vis_utils.py#L278-L348
Afterwards, head to your library path and paste that Python code there.
For example, my path is the following: C:/ProgramData/Anaconda3/envs/ml/Lib/site-packages/tensorflow/python/keras/utils/vis_utils.py. Yours should be something similar.

Related

FinRL tutorial multicrypto_trading error while executing Training part

Here I want to use FinRL for crypto trading, while testing the FinRL's Crypto trading tutorial, bunch of error emerging. The environment I use is google colab, first problem is that the DRLAgent importing, finally I found the problem is version mismatch, so I keep testing, after days and nights, adjusting so many version, I face a error can't be solved. When the tutorial comes to training part
train(start_date=TRAIN_START_DATE,
end_date=TRAIN_END_DATE,
ticker_list=TICKER_LIST,
data_source='binance',
time_interval='5m',
technical_indicator_list=INDICATORS,
drl_lib='elegantrl',
env=env,
model_name='ppo',
current_working_dir='./test_ppo',
erl_params=ERL_PARAMS,
break_step=5e4,
if_vix=False
)
it indicate the line of if_vix error, assert error, so I try to modify the git clone version, but I can't adjust some of the package's version, so I gave up and asking for help
here is the colab I use: https://colab.research.google.com/drive/1Ro63lSqsH4IaLkVrHOH7XcNRM5tnY_Z-
sorry for my poor english and thanks for helping!!
package altering but
!pip install git+
can't change version
and the package inside the git also not anchored
also facing assert error, bunch of capability problem

How to solve assertion error in Google Colab?

I'm attempting to write some code to generate a model for 3D segmentation. I'm using a model code provided by the creators of Stardist to write my code but I keep getting an assertion error and I'm not sure how to fix it.
Here is the code provided:
Screenshot of the code from Stardist github page
Here is my attempt at reconstructing the code with the error I get when I attempt to run it.
Screenshot of my code
I was wondering if people had any solutions for the problem I'm getting? I'm almost completely new to coding and using github as a whole so not sure if there's a way to create a direct download link, like they have, or if it should just be able to find my files directly off my hardrive. I also attach a picture of how my files are labelled so can't see why the code can't assertain they have the same labeling:
Image of my pathway for first, the images
and secondly, the masks.
Thank you all,
N

How to remove pre-loaded variables in PyCharm every time Python Terminal is Opened

I've encountered an issue where every time I open a new a Python console, it becomes loaded with what looks like extraneous global variables. In addition, when I import different libraries, it seems the method associated with that library are also imported to the variable workspace. I'm not quite sure how it got to this point, but before, opening up a new python console would leave the variable workspace clear until I explicitly declare the variable. In addition, importing libraries would not save the various methods. Shown below is an example of what appears upon creating a new python console.
I've tried commands such as
globals().clear()
and
%reset
but to no avail.
Any help would be appreciated!
Turns out there's a "Simplified Variables View" Option on the side which will fix that.

Output logs from pyscipopt

It may be a basic question, but how can I view the log of the solver after the model is optimized. I came across the option to hide the outputs by specifying model.hideOutput(). Is there an option to show the outputs (by default, I don't see any output log. I am using Spyder IDE).
Printing the SCIP output is activated by default in PySCIPOpt. As you already wrote, you would have to manually disable it by calling hideOutput(). Have you tried running your code in a terminal outside of Spyder? Is the model even solved, so did you check whether there is a solution in the end?
To complete the other answer: if your PySCIPOpt model has been created by third-party code, it is possible the output has been turned off upstream.
You can still call model.hideOutput(False) -- see the documentation of hideOutput().

Did tensorflow at any point change 'tensorflow.sub' into 'tensorflow.subtract'?

I was testing some code I was given and got an error saying:
AttributeError: 'module' object has no attribute 'sub'
The module referred to is TensorFlow. To investigate this error I started looking into the TensorFlow source code and found a function 'tensorflow.subtract'. Replacing 'sub' by 'subtract' made the error go away.
However now I am still wondering why the error occurred in the first place. I can think of 2 reasons:
At some point TensorFlow renamed 'sub' to 'subtract' and the code I was given hasn't yet updated to accommodate that change. Changing 'sub' to 'subtract' simply updated the code to the newer version of TensorFlow
I have made some mistake in importing the wrong libraries and TensorFlow does actually have a 'sub' function. This would mean that changing to 'subtract' potentially altered the workings of the program.
Can anyone give advice on what the most likely scenario is here?
The TensorFlow 1.0 release contained multiple breaking changes to the API, including the renaming of tf.sub to tf.subtract (likewise, tf.mul was renamed to tf.multiply et cetera). Comprehensive lists of all changes can be found here:
https://www.tensorflow.org/install/migration
https://github.com/tensorflow/tensorflow/releases/tag/v1.0.0