Created
February 13, 2017 12:08
-
-
Save kayhide/19a172a9513a9ffd4e6aa2624ea815d4 to your computer and use it in GitHub Desktop.
Dump yaml from python pickle file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import numpy | |
import yaml | |
network_file = 'sample_weight.pkl' | |
print("read: %(network_file)s" % locals()) | |
with open(network_file, 'rb') as f: | |
network = pickle.load(f) | |
for key in network.keys(): | |
dst = "%(key)s.yml" % locals() | |
print("write: %(dst)s" % locals()) | |
with open(dst, 'w') as f: | |
f.write(yaml.dump(network[key].tolist())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
このファイルを他の言語でも扱えるように yaml に変換するスクリプト。
python3 系が必要。
使い方
データファイルをダウンロードする。
スクリプトを実行する。