GithubHelp home page GithubHelp logo

lkklein / paddletools Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 8.0 81 KB

PaddlePaddle使用过程中可能用到的一些工具

License: MIT License

Python 100.00%
logger paddlepaddle params reminder tools

paddletools's People

Contributors

dependabot[bot] avatar gt-acerzhang avatar lkklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

paddletools's Issues

命令行和代码模式都报内存错误

[2021-02-24 19:44:18,704] [ INFO] - found 5 parameters. start to read.
Traceback (most recent call last):
File "/home/data/miniconda3/envs/paddle/bin/pdtools", line 8, in
sys.exit(main())
File "/home/data/miniconda3/envs/paddle/lib/python3.6/site-packages/paddletools/control.py", line 37, in main
static2dynamic(params_dir=cmd_args["--src"], save_path=cmd_args["--dst"])
File "/home/data/miniconda3/envs/paddle/lib/python3.6/site-packages/paddletools/checkpoints.py", line 65, in static2dynamic
data, data_type, lod_info = _read_static_params(param_path)
File "/home/data/miniconda3/envs/paddle/lib/python3.6/site-packages/paddletools/checkpoints.py", line 33, in _read_static_params
buf = struct.unpack("c" * buf_size, f.read(buf_size))
MemoryError

ubuntu16.04
python3.6 CUDA10.0 paddle2.0
内存16G
显卡1660ti

静态图转动态图后权重大小变大

静态图转动态图后,动态图权重字节数变大,比如 vgg16本应该是 527MB,转为动态图后大小变为795MB,这中间有什么问题吗?转换前后权重所占字节数不应该是差不多吗?

TypeError: got an unexpected keyword argument 'keep_name_table'

使用dynamic2static报错 paddlepaddle=1.63
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/site-packages/paddletools/checkpoints.py", line 101, in dynamic2static
static_dict = _read_dynamic_params(param_file)
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/site-packages/paddletools/checkpoints.py", line 49, in _read_dynamic_params
model_state_dict, _ = fluid.load_dygraph(param_file, keep_name_table=True)
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/site-packages/decorator.py", line 231, in fun
args, kw = fix(args, kw, sig)
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/site-packages/decorator.py", line 203, in fix
ba = sig.bind(*args, **kwargs)
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/inspect.py", line 2997, in bind
return args[0]._bind(args[1:], kwargs)
File "/home/ts/miniconda3/envs/paddle/lib/python3.6/inspect.py", line 2988, in _bind
arg=next(iter(kwargs))))
TypeError: got an unexpected keyword argument 'keep_name_table'

Error from dynamic graph to static graph, KeyError: 'StructuredToParameterName@@'

---------------------------------------------------------------------------KeyError Traceback (most recent call last) in
6 # !pdtools param to_dynamic -s output/darknet53/pretrain/DarkNet53/ -d DarkNet53
7 from paddletools.checkpoints import dynamic2static
----> 8 dynamic2static(param_file="output/darknet53/best_model/model", filename="111")
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddletools/checkpoints.py in dynamic2static(param_file, filename)
99 assert len(os.listdir(filename)) == 0, "dir {} should be empty!".format(filename)
100 logger.info("start to read dynamic params...")
--> 101 static_dict = _read_dynamic_params(param_file)
102 logger.info("found {} parameters. start to save to {}...".format(len(static_dict), filename))
103 for name, data in static_dict.items():
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddletools/checkpoints.py in _read_dynamic_params(param_file)
48 with fluid.dygraph.guard(place):
49 model_state_dict, _ = fluid.load_dygraph(param_file, keep_name_table=True)
---> 50 name_table = model_state_dict.pop("StructuredToParameterName@@")
51 for name, data in model_state_dict.items():
52 state_dict[name_table[name]] = data
KeyError: 'StructuredToParameterName@@'

paddle静态图转动态图报错

Traceback (most recent call last):
File "trans_dynamic.py", line 3, in
static2dynamic(params_dir="./assets/params/", save_path="./dy_params")
File "/home/LAB/r-zhanglt/anaconda3/lib/python3.7/site-packages/paddletools/checkpoints.py", line 65, in static2dynamic
data, data_type, lod_info = _read_static_params(param_path)
File "/home/LAB/r-zhanglt/anaconda3/lib/python3.7/site-packages/paddletools/checkpoints.py", line 33, in _read_static_params
buf = struct.unpack("c" * buf_size, f.read(buf_size))

静态图转动态图时出错

静态图转动态图时出现如下报错,是为啥呢
Traceback (most recent call last): File "change.py", line 4, in <module> static2dynamic(params_dir="params/", save_path="params") File "/home/disk2/hanzhao/anaconda3/lib/python3.7/site-packages/paddletools/checkpoints.py", line 65, in static2dynamic data, data_type, lod_info = _read_static_params(param_path) File "/home/disk2/hanzhao/anaconda3/lib/python3.7/site-packages/paddletools/checkpoints.py", line 33, in _read_static_params buf = struct.unpack("c" * buf_size, f.read(buf_size)) struct.error: unpack requires a buffer of 1634089506 bytes

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.