tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.46k stars 1.92k forks source link

C Tensorflow core changes in 2.4 #4193

Closed ASnow closed 3 years ago

ASnow commented 3 years ago

"C-API functions TF_StringDecode, TF_StringEncode, and TF_StringEncodedSize are no longer relevant and have been removed; see core/platform/ctstring.h for string access/modification in C."

This change has breaking building from source for tfjs-node-gpu.

  tfjs_backend.cc
  tfjs_binding.cc
  win_delay_load_hook.cc
C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\binding\tfjs_backend.cc(216,18): error C3861: TF_StringEncodedSize: идентификатор не найден [C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\binding\tfjs_backend.cc(241,9): error C3861: TF_StringEncode: идентификатор не найден [C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\binding\tfjs_backend.cc(374,5): error C3861: TF_StringDecode: идентификатор не найден [C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\dev\\trading\\node_modules\\@tensorflow\\tfjs-node-gpu\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--build-from-source" "--module=C:\\dev\\trading\\node_modules\\@tensorflow\\tfjs-node-gpu\\lib\\napi-v6\\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\\dev\\trading\\node_modules\\@tensorflow\\tfjs-node-gpu\\lib\\napi-v6" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
gyp ERR! cwd C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\node_modules\node-gyp\bin\node-gyp.js build --build-from-source --module=C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v6\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v6 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\dev\\trading\\node_modules\\@tensorflow\\tfjs-node-gpu\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--build-from-source"
node-pre-gyp ERR! cwd C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu
node-pre-gyp ERR! node -v v12.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\node_modules\node-gyp\bin\node-gyp.js build --build-from-source --module=C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v6\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\dev\trading\node_modules\@tensorflow\tfjs-node-gpu\lib\napi-v6 --napi_version=7 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
error Command failed with exit code 1.

System information

Describe the problem Can't build bindings

Provide the exact sequence of commands / steps that you executed before running into the problem

  1. Run: .\bazel.exe build --config=cuda --define=no_tensorflow_py_deps=true --config=opt --config=monolithic //tensorflow/tools/lib_package:libtensorflow
  2. Extract tar to deps
  3. Run node-pre-gyp rebuild
patrickhulce commented 3 years ago

Possibly also a blocker for M1 support using Apple's fork? (https://github.com/tensorflow/tfjs/issues/4514#issuecomment-758334433)

Perhaps @nickplee would gracious enough to upstream the fixes made over there :D

pyu10055 commented 3 years ago

@WenheLI Wenhe, do you think you have the bandwidth to take a look at this? It might be useful for pipcook, basically upgrade tfjs-node from TF 1.15 to TF 2.4.x. thanks!

WenheLI commented 3 years ago

@WenheLI Wenhe, do you think you have the bandwidth to take a look at this? It might be useful for pipcook, basically upgrade tfjs-node from TF 1.15 to TF 2.4.x. thanks!

Sure. I will take a look this week.

btsimonh commented 3 years ago

how's this going? Just starting out with tfjs on jetson nano, and don't want to do the symlink phreaking to make it work with cuda10.2 ... if it's immanent, then I'll hold off. s

WenheLI commented 3 years ago

how's this going? Just starting out with tfjs on jetson nano, and don't want to do the symlink phreaking to make it work with cuda10.2 ... if it's immanent, then I'll hold off.

Hi, I should be able to export an MVP for tf2.x this weekend. Will post any update in this thread.

WenheLI commented 3 years ago

@pyu10055 - Hi, just wondering where I can find the document for the new c-api about TF_String. I kinda know how to move the deps to tf2.x but I need to get an overview of how the new c-api works. Any documents that are available at this time?

WenheLI commented 3 years ago

Made a draft at https://github.com/tensorflow/tfjs/pull/4810

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No