DeepRec icon indicating copy to clipboard operation
DeepRec copied to clipboard

[Multi-Hash Variable] An error occurred when Multi-Hash Variable enabled in modelzoo's DIEN.

Open Duyi-Wang opened this issue 2 years ago • 0 comments

An error occurred when Multi-Hash Variable enabled in modelzoo's DIEN.
And the doc of Multi-Hash Variable should be updated. https://deeprec.readthedocs.io/zh/latest/Multi-Hash-Variable.html num_of_partitions param of get_multihash_variable is removed in the code which is still in the doc.

It seems that Multi-Hash Variable has something wrong with variable partitioner. error is type object 'float' has no attribute 'base_dtype', but object 'float' is the parameter passed down by default. Without using variable partitioner, another error occurred. 'MultiHashVariable' object has no attribute '_dtype'

Reproduce the issue The code and dataset is provide in docker image, docker pull cesg-prc-registry.cn-beijing.cr.aliyuncs.com/cesg-ali/deeprec-modelzoo:220401-dien-issue The DeepRec installed in the image is built on f4368d6a2679d6bc10bad6168eea37d6b91c2014 And run following code to reproduce the issue.

/root/modelzoo/DIEN
python train.py --steps 100 --no_eval --multihash True
# Disable variable partitioner 
python train.py --steps 100 --no_eval --multihash True --input_layer_partitioner 0 --dense_layer_partitioner 0

Other info / logs

Traceback (most recent call last):
  File "train.py", line 1147, in <module>
    main()
  File "train.py", line 903, in main
    dense_layer_partitioner=dense_layer_partitioner)
  File "train.py", line 157, in __init__
    self._create_model()
  File "train.py", line 464, in _create_model
    uid_emb, item_emb, his_item_emb, noclk_his_item_emb, sequence_length = self._embedding_input_layer(
  File "train.py", line 398, in _embedding_input_layer
    self._embedding_dim
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 2344, in get_multihash_variable
    aggregation=aggregation)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 1525, in get_variable
    aggregation=aggregation)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 805, in get_variable
    ht_partition_num=ht_partition_num)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 697, in _true_getter
    ht_partition_num=ht_partition_num)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 930, in _get_partitioned_variable
    partitions = _call_partitioner(partitioner, shape, dtype)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/variable_scope.py", line 3237, in _call_partitioner
    slicing = partitioner(shape=shape, dtype=dtype)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/partitioned_variables.py", line 205, in _partitioner
    if dtype.base_dtype == dtypes.string:
AttributeError: type object 'float' has no attribute 'base_dtype'
Traceback (most recent call last):
  File "train.py", line 1147, in <module>
    main()
  File "train.py", line 903, in main
    dense_layer_partitioner=dense_layer_partitioner)
  File "train.py", line 157, in __init__
    self._create_model()
  File "train.py", line 464, in _create_model
    uid_emb, item_emb, his_item_emb, noclk_his_item_emb, sequence_length = self._embedding_input_layer(
  File "train.py", line 423, in _embedding_input_layer
    item_embedding_var)
  File "train.py", line 344, in _get_embedding_input
    sparse_weights=sparse_tensors_weights)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/embedding_ops.py", line 1275, in safe_embedding_lookup_sparse
    if not (isinstance(w, resource_variable_ops.ResourceVariable) and dtype in (None, w.dtype)):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py", line 473, in dtype
    return self._dtype
AttributeError: 'MultiHashVariable' object has no attribute '_dtype'

Duyi-Wang avatar Apr 01 '22 03:04 Duyi-Wang