提交 a2411697 编写于 作者: HansBug's avatar HansBug 😆

fix(hansbug): fix plenty of grammar mistake, thanks to yefan

上级 744827ec
......@@ -27,7 +27,7 @@
`TreeValue` is a generalized tree-based data structure mainly developed by [OpenDILab Contributors](https://github.com/opendilab).
Almost all the operation can be supported in form of trees in a convenient way to simplify the structure processing when the calculation is tree-based.
Almost all the operations can be supported in the form of trees in a convenient way to simplify the structure processing when the calculation is tree-based.
## Outline
......@@ -46,21 +46,21 @@ Almost all the operation can be supported in form of trees in a convenient way t
## Overview
When we build a complex nested structure, we need to model it as a tree structure, and the native list and dict in Python are often used to solve this problem. However, it takes a lot of codes and some complex and non-intuitive calculation logics, which is not easy to modify and extend related code and data, and parallelization is more impossible.
When we build a complex nested structure, we need to model it as a tree structure, and the native list and dict in Python are often used to solve this problem. However, it takes a lot of codes and some complex and non-intuitive calculation logic, which is not easy to modify and extend related code and data, and parallelization is impossible.
Therefore, we need a kind of more proper data container, named `TreeValue`. It is designed for solving the follow problems:
Therefore, we need a kind of more proper data container, named `TreeValue`. It is designed for solving the following problems:
- **Ease of Use**: When the existing operations are applied to tree structures such as dict, they will become completely unrecognizable, with really low readability and maintainability.
- **Diversity of Data**: In the tree structure operation, various abnormal conditions (structure mismatch, missing key value, type mismatch, etc.) occur from time to time, and the code will be more complicated if it needs to be handled properly.
- **Diversity of Data**: In the tree structure operation, various abnormal conditions (structure mismatch, missing key-value, type mismatch, etc.) occur from time to time, and the code will be more complicated if it needs to be handled properly.
- **Scalability and Parallelization**: When any multivariate operation is performed, the calculation logic needs to be redesigned under the native Python code implementation, and the processing will be more complicated and confusing, and the code quality is difficult to control.
## Getting Started
### Prerequisite
`treevalue` has been fully tested in the Linux, macOS and Windows environment and with multiple Python versions, and it works properly on all these platforms.
`treevalue` has been fully tested in the Linux, macOS and Windows environments and with multiple Python versions, and it works properly on all these platforms.
However, **`treevalue` currently does not support PyPy**, so just pay attention to this when using.
However, **`treevalue` currently does not support PyPy**, so just pay attention to this when using it.
### Installation
......@@ -215,13 +215,13 @@ For more examples, explanations and further usages, take a look at:
### External
We provide an official treevalue-based-wrapper for numpy and torch called [DI-treetensor](https://github.com/opendilab/DI-treetensor) since the `treevalue` is often used with libraries like `numpy` and `torch`. It will actually be useful while working with AI fields.
We provide an official treevalue-based-wrapper for numpy and torch called [DI-treetensor](https://github.com/opendilab/DI-treetensor) since the `treevalue` is often used with libraries like `numpy` and `torch`. It will actually be helpful while working with AI fields.
## Speed Performance
Here is the speed performance of all the operations in `FastTreeValue`, the following table is the performance comparison result with [dm-tree](https://github.com/deepmind/tree).
Here is the speed performance of all the operations in `FastTreeValue`; the following table is the performance comparison result with [dm-tree](https://github.com/deepmind/tree).
| | flatten | flatten(with path) | mapping | mapping(with path) |
| --------------------------------------------------- | :--------------: | :-------------------: | :-------------------: | :-------------------------: |
......@@ -256,7 +256,7 @@ The following table is the performance comparison result with [tianshou Batch](h
| [treevalue](https://github.com/opendilab/treevalue) | 51.6 ns ± 0.609 ns | **64.4 ns ± 0.564 ns** | **750 ns ± 14.2 ns** | **88.9 µs ± 887 ns** | **50.2 µs ± 771 ns** | **40.3 µs ± 1.08 µs** | **62 µs ± 1.2 µs** |
| [tianshou Batch](https://github.com/thu-ml/tianshou) | **43.2 ns ± 0.698 ns** | 396 ns ± 8.99 ns | 11.1 µs ± 277 ns | 89 µs ± 1.42 µs | 119 µs ± 1.1 µs | 194 µs ± 1.81 µs | 653 µs ± 17.8 µs |
And this is the comparison between tianshou Batch and us, with `cat` , `stack` and `split` operations (**lower value means less time cost and runs faster**)
And this is the comparison between Tianshou Batch and us, with `cat` , `stack` and `split` operations (**lower value means less time cost and runs faster**)
![Time cost of cat operation](docs/source/_static/Time%20cost%20of%20cat%20operation.svg)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册