Git Product home page Git Product logo

Comments (6)

Laicheng0830 avatar Laicheng0830 commented on May 25, 2024

Modify code layer_names = [n.decode('utf8') for n in f.attrs["layer_names"]] to layer_names = [n if isinstance(n, str) else n.decode('utf8') for n in f.attrs["layer_names"]]

from tensorlayer.

jaried avatar jaried commented on May 25, 2024

tensorlayer\files\utils.py, line 2617, the same question, I modified。

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 2730, 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 2617, in _load_weights_from_hdf5_group_in_order
    weight_names = [n.decode('utf8') for n in g.attrs['weight_names']]
  File "D:\Anaconda3\envs\gym_env\lib\site-packages\tensorlayer\files\utils.py", line 2617, in <listcomp>
    weight_names = [n.decode('utf8') for n in g.attrs['weight_names']]
AttributeError: 'str' object has no attribute 'decode'

深圳?
Keep running, new questions:

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

from tensorlayer.

Laicheng0830 avatar Laicheng0830 commented on May 25, 2024

Line 2617 of the code also needs to be modified in the same way. Now this is a problem you may need to check if the parameters are imported correctly.This error occurs when the parameter shapes are inconsistent.

from tensorlayer.

jaried avatar jaried commented on May 25, 2024

原来的代码是tensorlayer提供的,问题也是tensorlayer产生的。
我在上面的回答中,也提到,2617行我已经改好了。
新的问题是2618行。

我是继续在这个issue提问还是新开一个issue?

The original code is provided by tensorlayer, and the problem is also generated by tensorlayer.
In my answer above, I also mentioned that I have changed line 2617.
The new problem is line 2618.

Do I continue to ask questions in this issue or open a new one?

from tensorlayer.

waqar3411 avatar waqar3411 commented on May 25, 2024

Hello @jaried... i resolved this issue by downgrading the h5py version to 2.10.0
pip install h5py==2.10.0

hope this helps...

from tensorlayer.

jaried avatar jaried commented on May 25, 2024

Thanks for your answer.

from tensorlayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.