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

IndexError: list index out of range #1156

Closed
jaried opened this issue Feb 16, 2022 · 0 comments
Closed

IndexError: list index out of range #1156

jaried opened this issue Feb 16, 2022 · 0 comments

Comments

@jaried
Copy link

jaried commented Feb 16, 2022

New Issue Checklist

Issue Description

IndexError: list index out of range

Reproducible Code

  • Which OS are you using ?
    windows 10 professional
    tensorlayer: 2.2.5
    tensorflow : 2.8
    python:3.7
  • Please provide a reproducible code of your issue. Without any reproducible code, you will probably not receive any help.

https://github.com/tensorlayer/tensorlayer/blob/master/examples/reinforcement_learning/tutorial_PG.py
Because of the previous issue AttributeError: 'str' object has no attribute 'decode' , I modified code of \tensorlayer\files\utils.py, line 2617 to weight_names = [n if isinstance(n, str) else n.decode('utf8') for n in f.attrs["layer_names"]] then :

Traceback (most recent call last):
  File "D:/Tony/Documents/yunpan/invest/2022/quant/gym/study PG/PG/pg.py", line 219, in <module>
    agent.load()
  File "D:/Tony/Documents/yunpan/invest/2022/quant/gym/study PG/PG/pg.py", line 161, in load
    tl.files.load_hdf5_to_weights_in_order(os.path.join(path, 'pg_policy.hdf5'), self.model)
  File "D:\Anaconda3\envs\gym_env\lib\site-packages\tensorlayer\files\utils.py", line 2729, in load_hdf5_to_weights_in_order
    _load_weights_from_hdf5_group_in_order(f, network.all_layers)
  File "D:\Anaconda3\envs\gym_env\lib\site-packages\tensorlayer\files\utils.py", line 2618, in _load_weights_from_hdf5_group_in_order
    assign_tf_variable(layer.all_weights[iid], np.asarray(g[w_name]))
IndexError: list index out of range
@jaried jaried closed this as completed Jun 29, 2022
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