Skip to content

Commit

Permalink
code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GodIsBoom committed Nov 8, 2022
1 parent 3642f12 commit 1ab793c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
26 changes: 13 additions & 13 deletions docs/en/faq/develop_a_new_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
### Pybind

* Create Pybind file

* Create path

* FastDeploy/fastdeploy/vision/classification/contrib/resnet_pybind.cc (FastDeploy/C++ code/vision model/taks name/external model/model name_pybind.cc)

* Create content

* Use Pybind to bind function variables from C++ to Python, please refer to [resnet_pybind.cc](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-270af0d65720310e2cfbd5373c391b2110d65c0f4efa547f7b7eeffcb958bdec) for more details.

```C++
void BindResNet(pybind11::module& m) {
pybind11::class_<vision::classification::ResNet, FastDeployModel>(
Expand All @@ -129,13 +129,13 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
```

* Call Pybind function

* modify path

* FastDeploy/fastdeploy/vision/classification/classification_pybind.cc (FastDeploy/C++ code/vision model/task name/task name}_pybind.cc)

* modify content

```C++
void BindResNet(pybind11::module& m);
void BindClassification(pybind11::module& m) {
Expand All @@ -151,7 +151,7 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
* Create path
* FastDeploy/python/fastdeploy/vision/classification/contrib/resnet.py (FastDeploy/Python code/fastdeploy/vision model/task name/external model/model name.py)
* Create content
* Create ResNet class inherited from FastDeployModel, and implement `\_\_init\_\_`, Pybind bonded functions (such as `predict()`), and `functions to assign and get global variables bound to Pybind`. Please refer to [resnet.py](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-a4dc5ec2d450e91f1c03819bf314c238b37ac678df56d7dea3aab7feac10a157) for details
* Create ResNet class inherited from FastDeployModel, and implement `\_\_init\_\_`, Pybind bonded functions (such as `predict()`), and `functions to assign and get global variables bound to Pybind`. Please refer to [resnet.py](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-a4dc5ec2d450e91f1c03819bf314c238b37ac678df56d7dea3aab7feac10a157) for details

```python
class ResNet(FastDeployModel):
Expand Down Expand Up @@ -245,7 +245,7 @@ make



To make the code clear for understanding, developers can annotate the newly-added code.
To make the code clear for understanding, developers can annotate the newly-added code.

- C++ code
Developers need to add annotations for functions and variables in the resnet.h file, there are three annotating methods as follows, please refer to [resnet.h](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff- 69128489e918f305c208476ba793d8167e77de2aa7cadf5dcbac30da448bd28e) for more details.
Expand All @@ -265,8 +265,8 @@ std::vector<int> size;
bool Initialize();
```
- Python
The following example is to demonstrate how to annotate functions and variables in resnet.py file. For more details, please refer to [resnet.py](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-a4dc5ec2d450e91f1c03819bf314c238b37ac678df56d7dea3aab7feac10a157).
- Python
The following example is to demonstrate how to annotate functions and variables in resnet.py file. For more details, please refer to [resnet.py](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-a4dc5ec2d450e91f1c03819bf314c238b37ac678df56d7dea3aab7feac10a157).
```python
def predict(self, input_image, topk=1):
Expand Down
2 changes: 1 addition & 1 deletion serving/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ Users can also compile the image by themselves according to their own needs, ref
## Other Tutorials

- [How to Prepare Serving Model Repository](docs/zh_CN/model_repository.md)
- [Serving Deployment Configuration for Runtime](docs/zh_CN/model_configuration.md)
- [Serving Deployment Configuration for Runtime](docs/zh_CN/model_configuration.md)
- [Serving Deployment Demo](docs/zh_CN/demo.md)
- [YOLOV5 - Detection Task](../examples/vision/detection/yolov5/serving/README.md)
4 changes: 2 additions & 2 deletions serving/docs/EN/model_repository-en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Model Repository

FastDeploy starts the serving by specifying one or more models in the model repository to deploy the service. When the serving is running, the models in the service can be modified following [Model Management](https://github.com/triton-inference-server/server/blob/main/docs/model_management.md), and obtain serving from one or more model repositories specified at the serving initiation.
FastDeploy starts the serving by specifying one or more models in the model repository to deploy the service. When the serving is running, the models in the service can be modified following [Model Management](https://github.com/triton-inference-server/server/blob/main/docs/model_management.md), and obtain serving from one or more model repositories specified at the serving initiation.

## Repository Architecture

Expand Down Expand Up @@ -64,7 +64,7 @@ Example: A minimal model repository directory for deploying Paddle models
└── config.pbtxt
```

To deploy an ONNX model, model with the name `model.onnx` must be included in the version directory
To deploy an ONNX model, model with the name `model.onnx` must be included in the version directory

Example: A minimal model repository directory for deploying ONNX models

Expand Down
4 changes: 2 additions & 2 deletions tools/auto_compression/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Fastdeploy Auto Compression can include multiple strategies, At present, offline
##### 1. Prepare models and Calibration data set

Developers need to prepare the model to be quantized and the Calibration dataset on their own.
In this demo, developers can execute the following command to download the yolov5s.onnx model to be quantized and calibration data set.
In this demo, developers can execute the following command to download the yolov5s.onnx model to be quantized and calibration data set.

```shell
# Download yolov5.onnx
Expand Down Expand Up @@ -109,7 +109,7 @@ To complete the quantization, developers only need to provide a customized model
| --method | Quantization method selection, PTQ for post-training quantization, QAT for quantization distillation training |
| --save_dir | Output of quantized model paths, which can be deployed directly in FastDeploy |

## 3. FastDeploy One-Click Model Auto Compression Config file examples
## 3. FastDeploy One-Click Model Auto Compression Config file examples
FastDeploy currently provides users with compression [config](./configs/) files of multiple models, and the corresponding FP32 model, Users can directly download and experience it.

| Config文件 | 待压缩的FP32模型 | 备注 |
Expand Down
4 changes: 1 addition & 3 deletions tools/auto_compression/configs/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PTQ:
calibration_method: 'avg' #Activate calibration algorithm of post-training quantization , Options: avg, abs_max, hist, KL, mse, emd
skip_tensor_list: None #Developers can skip some conv layers‘ quantization
#Traning
#Traning
TrainConfig:
train_iter: 3000
learning_rate: 0.00001
Expand All @@ -49,5 +49,3 @@ TrainConfig:
## More details

FastDeploy one-click quantization tool is powered by PaddeSlim, please refer to [Automated Compression of Hyperparameter Tutorial](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/hyperparameter_tutorial.md) for more details.


0 comments on commit 1ab793c

Please sign in to comment.