File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -307,11 +307,11 @@ unzip data.zip
307
307
--8<--
308
308
```
309
309
310
- ### 3.7 模型导出与推理
310
+ ### 3.9 模型导出与推理
311
311
312
312
训练完成后,我们可以将模型导出为静态图格式,并使用Python推理引擎进行部署。
313
313
314
- #### 3.7 .1 导出模型
314
+ #### 3.9 .1 导出模型
315
315
316
316
我们首先需要在 ` amgnet_cylinder.py ` 中实现 ` export ` 函数,它负责加载训练好的模型,并将其保存为推理所需的格式。
317
317
@@ -329,7 +329,7 @@ python amgnet_cylinder.py mode=export
329
329
330
330
导出的模型将包含 ` amgnet_cylinder.pdmodel ` (模型结构) 和 ` amgnet_cylinder.pdiparams ` (模型权重) 文件,保存在配置文件 ` INFER.export_path ` 所指定的目录中。
331
331
332
- #### 3.7 .2 创建推理器
332
+ #### 3.9 .2 创建推理器
333
333
334
334
为了执行推理,我们创建了一个专用的 ` AMGNPredictor ` 类,存放于 ` deploy/python_infer/amgn_predictor.py ` 。这个类继承自 ` ppsci.deploy.base_predictor.Predictor ` ,并实现了加载模型和执行预测的核心逻辑。
335
335
@@ -339,7 +339,7 @@ examples/amgnet/deploy/python_infer/amgn_predictor.py:28:87
339
339
-- 8 < --
340
340
```
341
341
342
- #### 3.7 .3 执行推理
342
+ #### 3.9 .3 执行推理
343
343
344
344
最后,我们实现 ` inference ` 函数。该函数会实例化 ` AMGNPredictor ` ,加载数据,并循环执行预测,最后将结果可视化。
345
345
@@ -355,7 +355,7 @@ examples/amgnet/amgnet_cylinder.py:259:298
355
355
python amgnet_cylinder.py mode=infer
356
356
```
357
357
358
- #### 3.7 .4 新增配置
358
+ #### 3.9 .4 新增配置
359
359
360
360
为了支持以上功能,需要在 ` conf/amgnet_cylinder.yaml ` 中添加 ` INFER ` 配置项。
361
361
You can’t perform that action at this time.
0 commit comments