TensorFlow 使 R 会话崩溃

问题描述

我尝试使用 R 中的 CRAN 版本安装 TensorFlow 和 Keras。但是,当我尝试使用某些功能时。例如load_model_tf 我收到类似这样的错误

*** caught illegal operation ***
address 0x1a0109874,cause 'illegal trap'

Traceback:
 1: py_module_import(module,convert = convert)
 2: import(module)
 3: doTryCatch(return(expr),name,parentenv,handler)
 4: tryCatchOne(expr,names,handlers[[1L]])
 5: tryCatchList(expr,classes,handlers)
 6: tryCatch({    import(module)    TRUE},error = clear_error_handler(FALSE))
 7: py_module_available("tensorflow")
 8: tf_config()
 9: tensorflow::tf_version()
10: load_model_tf("NN_model_comp")

Possible actions:
1: abort (with core dump,if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

有不同的错误代码,具体取决于执行的命令。

我的sessionInfo看起来像这样

R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] C

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

other attached packages:
 [1] randomForest_4.6-14 rpart_4.1-15        tensorflow_2.2.0    verification_1.42  
 [5] dtw_1.22-3          proxy_0.4-24        CircStats_0.2-6     MASS_7.3-53        
 [9] boot_1.3-25         fields_11.6         spam_2.5-1          dotCall64_1.0-0    
[13] keras_2.3.0.0       dplyr_1.0.2         caret_6.0-86        ggplot2_3.3.2      
[17] lattice_0.20-41    

loaded via a namespace (and not attached):
 [1] reticulate_1.18      tidyselect_1.1.0     purrr_0.3.4          reshape2_1.4.4      
 [5] splines_4.0.3        colorspace_2.0-0     vctrs_0.3.6          generics_0.1.0      
 [9] stats4_4.0.3         base64enc_0.1-3      survival_3.2-7       prodlim_2019.11.13  
[13] rlang_0.4.9          ModelMetrics_1.2.2.2 pillar_1.4.7         glue_1.4.2          
[17] withr_2.3.0          foreach_1.5.1        lifecycle_0.2.0      plyr_1.8.6          
[21] lava_1.6.8.1         stringr_1.4.0        timeDate_3043.102    munsell_0.5.0       
[25] gtable_0.3.0         recipes_0.1.15       codetools_0.2-16     tfruns_1.4          
[29] class_7.3-17         Rcpp_1.0.5           scales_1.1.1         ipred_0.9-9         
[33] jsonlite_1.7.2       stringi_1.5.3        tools_4.0.3          magrittr_2.0.1      
[37] maps_3.3.0           tibble_3.0.4         Crayon_1.3.4         whisker_0.4         
[41] pkgconfig_2.0.3      zeallot_0.1.0        ellipsis_0.3.1       Matrix_1.2-18       
[45] data.table_1.13.2    pROC_1.16.2          lubridate_1.7.9.2    gower_0.2.2         
[49] iterators_1.0.13     R6_2.5.0             nnet_7.3-14          nlme_3.1-149        
[53] compiler_4.0.3      

还有我的py_config这样的

python:         /Users/Simon/Library/r-miniconda/envs/r-reticulate/bin/python
libpython:      /Users/Simon/Library/r-miniconda/envs/r-reticulate/lib/libpython3.6m.dylib
pythonhome:     /Users/Simon/Library/r-miniconda/envs/r-reticulate:/Users/Simon/Library/r-miniconda/envs/r-reticulate
version:        3.6.12 | packaged by conda-forge | (default,Dec  9 2020,00:24:39)  [GCC Clang 11.0.0]
numpy:          /Users/Simon/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.4

如果您有任何建议,我将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)