-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0c88933
Showing
6 changed files
with
548 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
models/* | ||
downloads/* | ||
data/* | ||
|
||
.idea | ||
.vscode |
Empty file.
Empty file.
Empty 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-01-17T13:18:30.407261700Z", | ||
"start_time": "2024-01-17T13:18:30.398739100Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import pickle\n", | ||
"import json" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"DATA_PATH = \"../data/\"\n", | ||
"MODEL_PATH = \"../models/\"\n", | ||
"RUN_TYPE = \"ppo_runs/\"\n", | ||
"# Specify the path to your pickle file\n", | ||
"pickle_file_name = '../data/ppo_runs/ppo_sp_models_performance'\n", | ||
"pickle_file_path = pickle_file_name + '.pickle'\n", | ||
"\n", | ||
"# Open the file in binary mode and load the pickled data\n", | ||
"with open(pickle_file_path, 'rb') as file:\n", | ||
" data = pickle.load(file)\n", | ||
" # 转为格式化后的json\n", | ||
" json_data = json.dumps(data, indent=2)\n", | ||
" # 保存到文件\n", | ||
" with open(pickle_file_name + '.json', 'w') as json_file:\n", | ||
" json_file.write(json_data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pickle_file_path = MODEL_PATH + 'simple/' + 'FCP/' + 'dummy_env.pickle'\n", | ||
"\n", | ||
"with open(pickle_file_path, 'rb') as file:\n", | ||
" data = pickle.load(file)\n", | ||
" # 转为格式化后的json\n", | ||
" json_data = json.dumps(data, indent=2)\n", | ||
" # 保存到文件\n", | ||
" with open(MODEL_PATH + 'simple/' + 'FCP/' + 'dummy_env.json', 'w') as json_file:\n", | ||
" json_file.write(json_data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"dict = {'simple': {'PPO_SP+PPO_SP': [308.0, 272.0, 304.0, 340.0, 256.0], 'PPO_SP+BC_test_0': [80.0, 28.0, 152.0, 100.0, 120.0], 'PPO_SP+BC_test_1': [132.0, 80.0, 152.0, 132.0, 156.0]}, 'unident_s': {'PPO_SP+PPO_SP': [176.0, 200.0, 212.0, 188.0, 140.0], 'PPO_SP+BC_test_0': [32.0, 20.0, 28.0, 52.0, 60.0], 'PPO_SP+BC_test_1': [140.0, 112.0, 44.0, 96.0, 92.0]}, 'random1': {'PPO_SP+PPO_SP': [280.0, 288.0, 296.0, 264.0, 256.0], 'PPO_SP+BC_test_0': [28.0, 108.0, 72.0, 36.0, 40.0], 'PPO_SP+BC_test_1': [36.0, 72.0, 108.0, 24.0, 52.0]}, 'random0': {'PPO_SP+PPO_SP': [184.0, 184.0, 152.0, 184.0, 148.0], 'PPO_SP+BC_test_0': [36.0, 8.0, 20.0, 24.0, 20.0], 'PPO_SP+BC_test_1': [68.0, 12.0, 24.0, 36.0, 44.0]}, 'random3': {'PPO_SP+PPO_SP': [164.0, 140.0, 156.0, 132.0, 120.0], 'PPO_SP+BC_test_0': [28.0, 44.0, 36.0, 56.0, 36.0], 'PPO_SP+BC_test_1': [32.0, 56.0, 32.0, 40.0, 44.0]}}\n", | ||
"\n", | ||
"json_data = json.dumps(dict, indent=2)\n", | ||
"# 保存到文件\n", | ||
"with open('our.json', 'w') as json_file:\n", | ||
" json_file.write(json_data)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "pytorch2-cuda", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.