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

Bug in the layer's file #3

Open
SouravPal1995 opened this issue Jan 10, 2023 · 1 comment
Open

Bug in the layer's file #3

SouravPal1995 opened this issue Jan 10, 2023 · 1 comment

Comments

@SouravPal1995
Copy link

SouravPal1995 commented Jan 10, 2023

I am currently exploring your repository in order to implement the exact k recommendation system, As I was trying to run the training.py file I ran across this bug that I am unable to fix, i.e.,

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/ec2-user/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "train.py", line 26, in <module>
    g = Generator(is_training=True)
  File "/home/ec2-user/Sourav_Pal/exact-k-recommendation/model.py", line 121, in __init__
    mode="BEAMSEARCH", reuse=True, beam_size=hp.beam_size)
  File "/home/ec2-user/Sourav_Pal/exact-k-recommendation/layers.py", line 347, in ptn_rnn_decoder
    beam_sample(accum_logits, logits, point_mask, state, output_idxs)
  File "/home/ec2-user/Sourav_Pal/exact-k-recommendation/layers.py", line 325, in beam_sample
    pre_output_idxs = beam_select(pre_output_idxs, last_beam_id)
  File "/home/ec2-user/Sourav_Pal/exact-k-recommendation/layers.py", line 310, in beam_select
    for output_ta_flat in zip(*outputs_ta_flat)]
  File "/home/ec2-user/Sourav_Pal/exact-k-recommendation/layers.py", line 310, in <listcomp>
    for output_ta_flat in zip(*outputs_ta_flat)]
TypeError: 'map' object is not subscriptable

I know the location of the error, but I am unable to fix it. Also if possible please mention the dependencies of the code.

@Chuan1997
Copy link

You can rewrite the code as:
for output_ta_flat in zip(*outputs_ta_flat):
outputs_l = nest.pack_sequence_as(inputs_l[0], output_ta_flat)

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

2 participants