shenweichen / DeepCTR-Torch

【PyTorch】Easy-to-use,Modular and Extendible package of deep-learning based CTR models.
https://deepctr-torch.readthedocs.io/en/latest/index.html
Apache License 2.0
3.02k stars 705 forks source link

DIEN Model: ValueError: not enough values to unpack (expected 2, got 1) #206

Open btrgth opened 3 years ago

btrgth commented 3 years ago

Hi,

I can run and get results from DIN model. Also, I have used the same features in DIEN model as in DIN. When I run my experiment, it gives an error. In DIEN class, forward method of InterestExtractor module returns "zero_outputs" due to the fact that masked_keys_length.shape[0] equals zero.

How should I proceed on this error? I can work with DIN with the same dataset and features, why can't I work with DIEN?

Information related to this error is in below.

Error: ValueError: not enough values to unpack (expected 2, got 1)

Location: "models\dien.py" file Line number: 92

Screenshot from 2021-09-23 13-30-45

btrgth commented 3 years ago

By the way, if I add "aux_loss" as in following into the "forward" method of InterestExtractor module, it works.

if masked_keys_length.shape[0] == 0:
   return zero_outputs,

Used following code instead of above code. Is this a correct way?

if masked_keys_length.shape[0] == 0:
   return zero_outputs,aux_loss
zanshuxun commented 3 years ago

Did you set length_name="seq_length" in VarLenSparseFeat? what's the value of your behavior_length?

btrgth commented 3 years ago

I have already set length_name="seq_length" in VarLenSparseFeat, also maxlen value of it equals to 5.

kwmaeng91 commented 2 years ago

I also saw this. This happens when all the seq_length is zero for your batch. I just returned a zero tensor for the aux_loss and and it worked.