Closed nirivas closed 8 months ago
Hey @nirivas
See here for details. Numpy used np.float
as an alias for python's native float
, so the two are identical. But they deprecated these aliases, which is why the warning / error shows.
Using float
was / is identical to the former np.float
.
Hey there,
I have been trying to play with the AI training process but ran into the 'float' error below. Surprisingly it works with no errors on one computer but in the error (with the same python and cuda versions) I can't train my network. I went ahead and simply switched np.float to float in the python code and that seems to work. However, being a rookie with python I want to make sure this is an okay change and I am not completely derailing the process. It says one can also use np.float64, would that be the correct or better change? Any feedback is welcome !
TagLab 2023.5.17 Traceback (most recent call last): File "C:\TagLab-main\TagLab.py", line 4139, in trainNewNetwork dataset_train_info, train_loss_values, val_loss_values = training.trainingNetwork(images_dir_train, labels_dir_train, File "C:\TagLab-main\models\training.py", line 263, in trainingNetwork datasetTrain.computeAverage() File "C:\TagLab-main\models\coral_dataset.py", line 378, in computeAverage sum = np.zeros((self.CROP_SIZE, self.CROP_SIZE, 3), dtype=np.float) File "C:\Users\nirivas\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 353, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'float'.
np.floatwas a deprecated alias for the builtin
float. To avoid this error in existing code, use
floatby itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use
np.float64here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations