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

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

Open
Duyi-Wang opened this issue Apr 1, 2022 · 0 comments

Comments

@Duyi-Wang
Copy link
Contributor

Duyi-Wang commented Apr 1, 2022

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 f4368d6
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant