Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Evaluation error: ValueError: None values not supported.. #82

Open
ThomasWolf0701 opened this issue Oct 17, 2020 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@ThomasWolf0701
Copy link

Describe the bug

I ran the cell sample from the github page and till the compile step everything is fine.
When running the compile step I get:

Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: ValueError: None values not supported..

A clear and concise description of what the bug is as
Detailed traceback:

Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: ValueError: None values not supported..

File "C:\Users\THOMAS1\DOCUME1\CONDA1\envs\R-RETI1\lib\site-packages\tensorflow_core\python\ops\math_ops.py", line 1422, in range
limit = ops.convert_to_tensor(limit, name="limit")
File "C:\Users\THOMAS1\DOCUME1\CONDA1\envs\R-RETI1\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1184, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "C:\Users\THOMAS1\DOCUME1\CONDA1\envs\R-RETI1\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1242, in convert_to_tensor_v2
as_ref=False)
File "C:\Users\THOMAS1\DOCUME1\CONDA1\envs\R-RETI1\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1296, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\THOMAS1\DOCUME1\CONDA1\envs\R-RETI1\lib\site-packages\tensorflow_c

The output after running yolo3

2020-10-17 19:37:03.572520: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-10-17 19:37:06.629388: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-10-17 19:37:06.667244: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.645
pciBusID: 0000:01:00.0
2020-10-17 19:37:06.667676: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-10-17 19:37:06.668985: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-10-17 19:37:06.669443: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-10-17 19:37:06.672431: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.645
pciBusID: 0000:01:00.0
2020-10-17 19:37:06.672801: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-10-17 19:37:06.674102: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-10-17 19:37:07.358505: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-10-17 19:37:07.358893: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2020-10-17 19:37:07.359069: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2020-10-17 19:37:07.360054: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6794 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)

The code i ran
library(tidyverse)
library(platypus)
library(abind)

BCCD_path <- "BCCD/"
annot_path <- file.path(BCCD_path, "Annotations/")
blood_labels <- c("Platelets", "RBC", "WBC")
n_class <- length(blood_labels)
net_h <- 416 # Must be divisible by 32
net_w <- 416 # Must be divisible by 32
anchors_per_grid <- 3

blood_anchors <- generate_anchors(
anchors_per_grid = anchors_per_grid, # Number of anchors (per one grid) to generate
annot_path = annot_path, # Annotations directory
labels = blood_labels, # Class labels
n_iter = 10, # Number of k-means++ iterations
annot_format = "pascal_voc", # Annotations format
seed = 55, # Random seed
centroid_fun = mean # Centroid function
)

blood_yolo <- yolo3(
net_h = net_h, # Input image height
net_w = net_w, # Input image width
grayscale = FALSE, # Should images be loaded as grayscale or RGB
n_class = n_class, # Number of object classes (80 for COCO dataset)
anchors = blood_anchors # Anchor boxes
)
blood_yolo %>% load_darknet_weights("yolov3.weights") # Optional

YOUR CODE HERE

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Session information (please complete the following information):

OS: [e.g. iOS]:
R version:
Python version:
TensorFlow (Python) version (tensorflow::tf_version()):
R session information (sessionInfo()):
@ThomasWolf0701
Copy link
Author

Now i did a reinstall of keras and now get the error:
after:

blood_yolo %>%

  • fit_generator(
    
  •     generator = blood_yolo_generator,
    
  •     epochs = 1000,
    
  •     steps_per_epoch = 19,
    
  •     validation_data = valid_blood_yolo_generator,
    
  •     validation_steps = 5,
    
  •     callbacks = list(callback_model_checkpoint("development/BCCD/blood_w.hdf5",
    
  •                                                save_best_only = TRUE,
    
  •                                                save_weights_only = TRUE)
    
  •     )
    
  • )
    

Fehler in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: in user code:

C:\Users\THOMAS~1\DOCUME~1\CONDA~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\keras\engine\training.py:571 train_function  *
    outputs = self.distribute_strategy.run(
C:\Users\THOMAS~1\DOCUME~1\CONDA~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:951 run  **
    return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
C:\Users\THOMAS~1\DOCUME~1\CONDA~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2290 call_for_each_replica
    return self._call_for_each_replica(fn, args, kwargs)
C:\Users\THOMAS~1\DOCUME~1\CONDA~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2649 _call_for_each_replica
    return fn(*args, **kwargs)
C:\Users\THOMAS~1\DOCUME~1\CONDA~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\keras\engine\training.py:533 train_step  **
    y, y_pred, sample_weight, regulariza

@maju116 maju116 added the bug Something isn't working label Oct 17, 2020
@maju116 maju116 self-assigned this Oct 17, 2020
@maju116
Copy link
Owner

maju116 commented Oct 17, 2020

@ThomasWolf0701 there is a problem with custom R generators fitting with R keras package, plese see: #70
I'm still working on permanent fix. Please provide your session info, R version, TensorFlow version (python) ans system (windows, linux, Mac)

@ThomasWolf0701
Copy link
Author

R version: 3.6.3
Tensorflow: 2.2
System: Windows

@ThomasWolf0701
Copy link
Author

Is there a Tensorflow version for which this works ?

@maju116
Copy link
Owner

maju116 commented Oct 17, 2020

@ThomasWolf0701 what version of R packages (keras, tensorflow) do you have ?

@ThomasWolf0701
Copy link
Author

@ThomasWolf0701 what version of R packages (keras, tensorflow) do you have ?

Here is the code i ran:

library(tidyverse)
library(platypus)
library(abind)

BCCD_path <- "development/BCCD/"
annot_path <- file.path(BCCD_path,"Annotations/")
blood_labels <- c("Platelets", "RBC", "WBC")
n_class <- length(blood_labels)
net_h <- 416 # Must be divisible by 32
net_w <- 416 # Must be divisible by 32
anchors_per_grid <- 3

blood_anchors <- generate_anchors(
anchors_per_grid = anchors_per_grid, # Number of anchors (per one grid) to generate
annot_path = annot_path, # Annotations directory
labels = blood_labels, # Class labels
n_iter = 10, # Number of k-means++ iterations
annot_format = "pascal_voc", # Annotations format
seed = 55, # Random seed
centroid_fun = mean # Centroid function
)

blood_yolo <- yolo3(
net_h = net_h, # Input image height
net_w = net_w, # Input image width
grayscale = FALSE, # Should images be loaded as grayscale or RGB
n_class = n_class, # Number of object classes (80 for COCO dataset)
anchors = blood_anchors # Anchor boxes
)

blood_yolo %>% load_darknet_weights("development/yolov3.weights") # Optional

blood_yolo %>% compile(
optimizer = optimizer_adam(),
loss = yolo3_loss(blood_anchors, n_class = n_class),
metrics = yolo3_metrics(blood_anchors, n_class = n_class)
)

Now i am back to getting the following error already after the compile step:
Fehler in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: ValueError: None values not supported.

Detailed traceback:
File "C:\Users\Thomas Wolf\anaconda3\lib\site-packages\tensorflow_core\python\ops\math_ops.py", line 1430, in range
limit = ops.convert_to_tensor(limit, dtype=dtype, name="limit")
File "C:\Users\Thomas Wolf\anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1314, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\Thomas Wolf\anaconda3\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 317, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Users\Thomas Wolf\anaconda3\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 258, in constant
allow_broadcast=True)
File "C:\Users\Thomas Wolf\anaconda3\lib\site-packages\tensorflow_core\python\framework\constant_op.py", line 296, in _constant_impl
allow_bro

The session info:

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] abind_1.4-5 platypus_0.1.1 keras_2.3.0.0 tensorflow_2.2.0 forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4
[9] readr_1.4.0 tidyr_1.1.2 tibble_3.0.4 ggplot2_3.3.2 tidyverse_1.3.0

loaded via a namespace (and not attached):
[1] progress_1.2.2 reticulate_1.16 tidyselect_1.1.0 haven_2.3.1 lattice_0.20-41 colorspace_1.4-1 vctrs_0.3.4
[8] generics_0.0.2 base64enc_0.1-3 XML_3.99-0.5 blob_1.2.1 rlang_0.4.8 pillar_1.4.6 glue_1.4.2
[15] withr_2.3.0 DBI_1.1.0 rappdirs_0.3.1 dbplyr_1.4.4 RColorBrewer_1.1-2 modelr_0.1.8 readxl_1.3.1
[22] lifecycle_0.2.0 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_0.3.6 labeling_0.3 tfruns_1.4
[29] fansi_0.4.1 broom_0.7.1 Rcpp_1.0.5 scales_1.1.1 backports_1.1.10 jsonlite_1.7.1 farver_2.0.3
[36] fs_1.5.0 gridExtra_2.3 digest_0.6.25 hms_0.5.3 stringi_1.5.3 grid_4.0.3 cli_2.1.0
[43] tools_4.0.3 magrittr_1.5 crayon_1.3.4 whisker_0.4 pkgconfig_2.0.3 zeallot_0.1.0 ellipsis_0.3.1
[50] Matrix_1.2-18 prettyunits_1.1.1 xml2_1.3.2 reprex_0.3.0 lubridate_1.7.9 assertthat_0.2.1 httr_1.4.2
[57] rstudioapi_0.11 R6_2.4.1 compiler_4.0.3

The reticulate info:

library(reticulate)
py_config()
python: C:/Users/Thomas Wolf/anaconda3/python.exe
libpython: C:/Users/Thomas Wolf/anaconda3/python37.dll
pythonhome: C:/Users/Thomas Wolf/anaconda3
version: 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: C:/Users/Thomas Wolf/anaconda3/Lib/site-packages/numpy
numpy_version: 1.18.1
tensorflow: C:\Users\THOMAS1\ANACON1\lib\site-packages\tensorflow_init_.p

python versions found:
C:/Users/Thomas Wolf/anaconda3/python.exe
C:/Users/Thomas Wolf/anaconda3/envs/my-rdkit-env/python.exe
C:/Users/Thomas Wolf/anaconda3/envs/r-tf/python.exe

I ran the example from this page and it runs just fine:
https://tensorflow.rstudio.com/guide/keras/

@maju116
Copy link
Owner

maju116 commented Oct 18, 2020

@ThomasWolf0701 please install platypus package from yolo3_fix branch: remotes::install_github("maju116/platypus@yolo3_fix") and instead of fit_generator function use yolo3_fit_generator function like in the example below:
https://github.com/maju116/platypus/blob/yolo3_fix/examples/Blood%20Cell%20Detection/Blood-Cell-Detection.md

It's still work in progress, but I hope it will be enough for now. Let me know if it's working for you.

@ThomasWolf0701
Copy link
Author

@ThomasWolf0701 please install platypus package from yolo3_fix branch: remotes::install_github("maju116/platypus@yolo3_fix") and instead of fit_generator function use yolo3_fit_generator function like in the example below:
https://github.com/maju116/platypus/blob/yolo3_fix/examples/Blood%20Cell%20Detection/Blood-Cell-Detection.md

It's still work in progress, but I hope it will be enough for now. Let me know if it's working for you.

Tested it with a tensorflow 2.2 backend without gpu support for two epochs, and it´s working now. Mayn thanks for your help. Will let you know when I tested with GPU support.

@maju116
Copy link
Owner

maju116 commented Oct 18, 2020

@ThomasWolf0701 In my settings I still have en error when using yolo3_fit_generator if in the yolo3_generator I set shuffle = FALSE so for the moment please use shuffle = TRUE when creating generators for yolo3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants