diff --git a/chapter_distributed_training/methods.md b/chapter_distributed_training/methods.md index f6ddfc9..4956c5f 100644 --- a/chapter_distributed_training/methods.md +++ b/chapter_distributed_training/methods.md @@ -51,7 +51,7 @@ Communication)的Allreduce操作来完成。 ### 模型并行 -![模型并行系统:算子内并行](../img/ch09/ch10-model-parallel-intra-op.svg) +![模型并行系统:算子内并行](../img/ch09/ch10-model-parallel-intra-op.png) :width:`800px` :label:`ch10-model-parallel-intra-op` diff --git a/img/ch09/ch10-model-parallel-intra-op.png b/img/ch09/ch10-model-parallel-intra-op.png new file mode 100644 index 0000000..1a9ddcd Binary files /dev/null and b/img/ch09/ch10-model-parallel-intra-op.png differ diff --git a/img/ch09/ch10-model-parallel-intra-op.svg b/img/ch09/ch10-model-parallel-intra-op.svg deleted file mode 100644 index 5c567cd..0000000 --- a/img/ch09/ch10-model-parallel-intra-op.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - -算⼦2设备1设备2数据分区1分区2Broadcast(⼴播)Gather(合并)算⼦1算⼦1程序分区1程序分区2 diff --git a/tools/format_tables.py b/tools/format_tables.py index 8b1d132..7e270c8 100644 --- a/tools/format_tables.py +++ b/tools/format_tables.py @@ -9,27 +9,33 @@ import os root_path = "./" html_root_path = "_build/html/" + def get_html_list(): - index_html_path = os.path.join(root_path,html_root_path ,"index.html") + index_html_path = os.path.join(root_path, html_root_path, "index.html") index_soup = BeautifulSoup(open(index_html_path)) - content_list = index_soup.find(name="div", attrs={"class":"globaltoc"}).\ + content_list = index_soup.find(name="div", attrs={"class": "globaltoc"}). \ find_all(name="a", attrs={"class": "reference internal"}) - html_list = [os.path.join(html_root_path,content_name["href"]) for content_name in content_list] + html_list = [os.path.join(html_root_path, content_name["href"]) for content_name in content_list] return html_list + def format_table(): html_list = get_html_list() for html_file in html_list: - soup = BeautifulSoup(open(html_file)) - all_tables = soup.find_all(name="table", attrs={"class":"docutils align-default"}) - for table in all_tables: - table["style"] = "margin-left:auto;margin-right:auto;margin-top:10px;margin-bottom:20px;" + try: + soup = BeautifulSoup(open(html_file)) + all_tables = soup.find_all(name="table", attrs={"class": "docutils align-default"}) + for table in all_tables: + table["style"] = "margin-left:auto;margin-right:auto;margin-top:10px;margin-bottom:20px;" + + if len(all_tables): + write_out_file = open(html_file, mode="w") + write_out_file.write(soup.prettify()) + write_out_file.close() + except: + pass + - if len(all_tables): - write_out_file = open(html_file, mode="w") - write_out_file.write(soup.prettify()) - write_out_file.close() - if __name__ == "__main__": format_table() \ No newline at end of file