Skip to content

Commit

Permalink
Merge branch 'PaddlePaddle:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
1649759610 authored Jan 12, 2023
2 parents 3801098 + 06de433 commit 804f394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions model_zoo/ernie-tiny/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ERNIE 3.0 Tiny
# ERNIE 3.0 Tiny: Frustratingly Simple Method to Improve Task-Agnostic Distillation Generalization

**目录**
* [ERNIE 3.0 Tiny 介绍](#模型介绍)
Expand Down Expand Up @@ -569,12 +569,12 @@ python run_eval.py \

尽管 ERNIE 3.0 Tiny 已提供了效果不错的轻量级模型可以微调后直接使用,但在本项目中,微调后的模型体积是 69.0 MB,内存占用达到 115.72MB,部署至移动端还是存在一定困难。因此当模型有部署上线的需求,想要进一步压缩模型体积,降低推理时延,可使用本项目的 **端上语义理解压缩方案** 对上一步微调后的模型进行压缩。

为了方便实现,[PaddleNLP 模型压缩 API](../../docs/compression.md) 已提供了以下压缩功能。
为了方便实现,[PaddleNLP 模型压缩 API](../../docs/compression.md) 已提供了以下压缩功能,模型压缩API主要是基于[PaddleSlim](https://github.com/PaddlePaddle/PaddleSlim)模型压缩能力,PaddleSlim是一个专注于深度学习模型压缩的工具库,提供低比特量化、知识蒸馏、稀疏化和模型结构搜索等模型压缩策略,帮助开发者快速实现模型的小型化,欢迎大家使用

端上模型压缩流程如下图所示:

<p align="center">
<img width="1000" alt="image" src="https://user-images.githubusercontent.com/26483581/211022166-0558371b-c5b2-4a7a-a019-674f0a321ccf.png" title="compression plan">
<img width="1000" alt="image" src="https://user-images.githubusercontent.com/16698950/212007542-b651c57a-9e4e-46c2-8724-cd7a6a20973f.png" title="compression plan">
</p>
<br>

Expand Down
7 changes: 4 additions & 3 deletions tests/test_tipc/benchmark/modules/ernie_tiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import os
import sys
from functools import partial

import paddle.nn as nn
from paddle.io import BatchSampler, DataLoader, DistributedBatchSampler
Expand All @@ -25,13 +26,13 @@

from .model_base import BenchmarkBase

sys.path.append(
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "model_zoo", "ernie-3.0")
)
),
)

from functools import partial # noqa: E402

from utils import seq_convert_example # noqa: E402

Expand Down

0 comments on commit 804f394

Please sign in to comment.