How to use add_pth method in localstack

Best Python code snippet using localstack_python

draw.py

Source:draw.py Github

copy

Full Screen

...63 plt.plot(idxs, data, label=label)64 plt.title(title)65 plt.legend(loc="upper right", frameon=True, fontsize=8)66 plt.savefig(save_path)67def add_pth(a, b):68 return os.path.join(a, b)69if __name__ == "__main__":70 args = _parse_args()71 txt_root = args.txt_root72 save_root = args.save_root73 assert os.path.exists(74 txt_root75 ), 'you should run "check/check.sh" before drawing graphs'76 # draw and save77 os.makedirs(save_root, exist_ok=True)78 draw_and_save(79 {80 "title": "compare_acc",81 "save_path": add_pth(save_root, "acc.png"),82 "txts": [83 add_pth(txt_root, "eager_acc.txt"),84 add_pth(txt_root, "graph_acc.txt"),85 ],86 "names": ["eager_acc", "graph_acc"],87 "xlabel": "epochs",88 "ylabel": "acc",89 }90 )91 draw_and_save(92 {93 "title": "compare_loss",94 "save_path": add_pth(save_root, "compare_loss.png"),95 "txts": [96 add_pth(txt_root, "eager_losses.txt"),97 add_pth(txt_root, "graph_losses.txt"),98 ],99 "names": ["eager_loss", "graph_loss"],100 "xlabel": "epochs",101 "ylabel": "loss",102 }103 )104 draw_and_save(105 {106 "title": "compare_train_step_time",107 "save_path": add_pth(save_root, "compare_train_step_time.png"),108 "txts": [109 add_pth(txt_root, "eager_train_step_time_list.txt"),110 add_pth(txt_root, "graph_train_step_time_list.txt"),111 ],112 "names": ["eager_step_time", "graph_step_time"],113 "xlabel": "iters",114 "ylabel": "time(s)",115 "ylim": [0, 1],116 }117 )118 draw_and_save(119 {120 "title": "compare_train_epoch_time",121 "save_path": add_pth(save_root, "compare_train_epoch_time.png"),122 "txts": [123 add_pth(txt_root, "eager_train_epoch_time_list.txt"),124 add_pth(txt_root, "graph_train_epoch_time_list.txt"),125 ],126 "names": ["eager_epoch_time", "graph_epoch_time"],127 "xlabel": "epochs",128 "ylabel": "time(s)",129 }130 )131 draw_and_save(132 {133 "title": "compare_eval_epoch_time",134 "save_path": add_pth(save_root, "compare_eval_epoch_time.png"),135 "txts": [136 add_pth(txt_root, "eager_eval_epoch_time_list.txt"),137 add_pth(txt_root, "graph_eval_epoch_time_list.txt"),138 ],139 "names": ["eager_eval_time", "graph_eval_time"],140 "xlabel": "epochs",141 "ylabel": "time(s)",142 }143 )144 draw_and_save(145 {146 "title": "compare_abs_loss",147 "save_path": add_pth(save_root, "compare_abs_loss.png"),148 "txts": [149 add_pth(txt_root, "eager_losses.txt"),150 add_pth(txt_root, "graph_losses.txt"),151 ],152 "names": ["eager_loss", "graph_loss"],153 "xlabel": "iters",154 "ylabel": "abs_loss",155 "do_abs_minus": True,156 }157 )158 draw_and_save(159 {160 "title": "compare_abs_model_param",161 "save_path": add_pth(save_root, "compare_abs_model_param.png"),162 "txts": [add_pth(txt_root, "eager_graph_model_diff_list.txt")],163 "names": ["model_param_abs_diff"],164 "xlabel": "iters",165 "ylabel": "abs_diff",166 }...

Full Screen

Full Screen

draw_img.py

Source:draw_img.py Github

copy

Full Screen

...71 plt.plot(idxs, data, label=label)72 plt.title(title)73 plt.legend(loc="upper right", frameon=True, fontsize=8)74 plt.savefig(save_path)75def add_pth(a, b):76 return os.path.join(a, b)77if __name__ == "__main__":78 args = _parse_args()79 # txt_root = args.txt_root80 save_root = args.save_root81 # assert os.path.exists(txt_root), 'you should run "check/check.sh" before drawing graphs'82 # draw and save83 os.makedirs(save_root, exist_ok=True)84 draw_and_save(85 {86 "title": "eager_graph_ddp_vs_consistent_loss_compare",87 "save_path": add_pth(save_root, "eager_graph_4gpu_ddp_vs_consistent.png"),88 "txts": [89 # "loss_txt/bert_graph_sgd_amp_consistent_ddp_1gpu_loss.txt",90 # "../../OneFlow-Benchmark/LanguageModeling/BERT/loss_txt/loss_info_sgd_amp_ddp_4gpu_diffpart_zwx.txt",91 # "../../OneFlow-Benchmark/LanguageModeling/BERT/loss_txt/loss_info_sgd_amp_ddp_4gpu_shuffle_zwx.txt",92 # "../../OneFlow-Benchmark/LanguageModeling/BERT/loss_txt/loss_info_sgd_amp_ddp_4gpu_shuffle.txt",93 # "../../OneFlow-Benchmark/LanguageModeling/BERT/loss_info_sgd_amp_ddp_1gpu.txt",94 "loss_txt/bert_graph_sgd_amp_consistent_4gpu_4partdiff_fp32_loss.txt",95 [96 "loss_txt/bert_4gpu_eager_consistent_diff_loss0.txt",97 "loss_txt/bert_4gpu_eager_consistent_diff_loss1.txt",98 "loss_txt/bert_4gpu_eager_consistent_diff_loss2.txt",99 "loss_txt/bert_4gpu_eager_consistent_diff_loss3.txt",100 ],101 ],102 "names": [103 "graph_consistent_fp32_loss",104 "eager_ddp_loss",105 ], # "lazy_reapeat4part_loss"106 "xlabel": "iter",107 "ylabel": "loss",108 }109 )110 # draw_and_save(111 # {112 # "title": "lazy_graph_adamw_lr1e-3_loss_compare",113 # "save_path": add_pth(save_root, "lazy_graph_adam.png"),114 # "txts": [115 # "../../OneFlow-Benchmark/LanguageModeling/BERT/loss_info_adamw_exclude.txt",116 # "loss_txt/bert_graph_adamw_exclude_loss.txt",117 # ],118 # "names": ["lazy_loss", "graph_loss"],119 # "xlabel": "iter",120 # "ylabel": "loss",121 # }122 # )123 # draw_and_save({ "title": "compare_abs_loss",124 # "save_path": add_pth(save_root, "compare_abs_loss.png"),125 # "txts": [add_pth(txt_root, "eager_losses.txt"),126 # add_pth(txt_root, "graph_losses.txt")],127 # "names": ["eager_loss", "graph_loss"],128 # "xlabel": "iters",129 # "ylabel": "abs_loss",130 # "do_abs_minus": True...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful