DeepRec icon indicating copy to clipboard operation
DeepRec copied to clipboard

[Optimizer] get_embedding_variable_internal keyword argument error when use custom optimizer

Open Gforky opened this issue 3 years ago • 5 comments

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS7
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): 1.15.5
  • Python version: 3.7.4
  • Bazel version (if compiling from source): 0.24.1
  • GCC/Compiler version (if compiling from source): 7.3.1
  • CUDA/cuDNN version: None
  • GPU model and memory: None

Describe the current behavior Using get_embedding_variable to create an EmbeddingVariable for embedding lookup, but encounters unexpected keyword argument issue while creating slot var, the detailed error stack is:

  File "/usr/local/python3.7/lib/python3.7/site-packages/tensorflow_core/python/training/optimizer.py", line 1302, in _zeros_slot
    new_slot_variable = slot_creator.create_zeros_slot(var, op_name, slot_config=slot_config)
  File "/usr/local/python3.7/lib/python3.7/site-packages/tensorflow_core/python/training/slot_creator.py", line 266, in create_zeros_slot
    slot_config=slot_config)
  File "/usr/local/python3.7/lib/python3.7/site-packages/tensorflow_core/python/training/slot_creator.py", line 239, in create_slot_with_initializer
    dtype, slot_config)
  File "/usr/local/python3.7/lib/python3.7/site-packages/tensorflow_core/python/training/slot_creator.py", line 92, in _create_slot_var
    ht_partition_num=primary._ht_partition_num)
TypeError: get_embedding_variable_internal() got an unexpected keyword argument 'ht_partition_num'

Describe the expected behavior Training without error. Maybe _create_slot_var should use get_embedding_variable_v2_internal for all cases.

Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem.

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

Gforky avatar Apr 14 '22 06:04 Gforky

Hi, Could you please tell me which optimizer you are using in your code?

lixy9474 avatar Apr 15 '22 02:04 lixy9474

Hi, Could you please tell me which optimizer you are using in your code?

Hi, I use a customized optimizer, which will call the _zeros_slot function without passing slot_config parameter.

Gforky avatar Apr 15 '22 02:04 Gforky

Ok, I know the cause of this problem, I will fix this bug. Also, can you tell me which team you are from, we would like to know if your custom optimizer can be added to DeepRec.

lixy9474 avatar Apr 15 '22 03:04 lixy9474

Ok, I know the cause of this problem, I will fix this bug. Also, can you tell me which team you are from, we would like to know if your custom optimizer can be added to DeepRec.

Sure, we are glad to contribute our customized optimizer to DeepRec, I'm from team of JD.com.

Gforky avatar Apr 15 '22 08:04 Gforky

If customized optimizer support sparse feature (EV) in DeepRec, _zeros_slot should pass slot_config parameter. Could you show me your code? You can submit a PR.

candyzone avatar Apr 18 '22 07:04 candyzone