Skip to content

Commit fc4aaab

Browse files
ezirmusituaalabulei1juntao
authored
add zh-cn translation (#185)
* translate i18n/zh/docusaurus-plugin-content-docs/current/start/ overview.md Signed-off-by: ezirmusitua <[email protected]> * add zh-cn translation Signed-off-by: ezirmusitua <[email protected]> * fix: repo references Signed-off-by: ezirmusitua <[email protected]> * Signed-off-by: alabulei1 <[email protected]> * Update llm inference docs (#187) Signed-off-by: alabulei1 <[email protected]> * Update llm_inference.md Signed-off-by: alabulei1 <[email protected]> Signed-off-by: Michael Yuan <[email protected]> * Update llm_inference.md Signed-off-by: alabulei1 <[email protected]> Signed-off-by: Michael Yuan <[email protected]> * Update llm_inference.md Signed-off-by: Michael Yuan <[email protected]> * Update llm_inference.md Signed-off-by: Michael Yuan <[email protected]> * translate i18n/zh/docusaurus-plugin-content-docs/current/start/overview.md (#183) * translate i18n/zh/docusaurus-plugin-content-docs/current/start/ overview.md Signed-off-by: ezirmusitua <[email protected]> * Update overview.md Signed-off-by: ezirmusitua <[email protected]> --------- Signed-off-by: ezirmusitua <[email protected]> * add missing links Signed-off-by: ezirmusitua <[email protected]> * fix links in plugins(zh) Signed-off-by: ezirmusitua <[email protected]> * add missing links Signed-off-by: ezirmusitua <[email protected]> * doc: remove unnecessary space Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392653345 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392652961 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392647856 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392604553 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392650533 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392621661 Signed-off-by: ezirmusitua <[email protected]> * apply suggestion https://github.com/WasmEdge/docs/pull/185\#discussion_r1392632935 Signed-off-by: ezirmusitua <[email protected]> * fix translations Signed-off-by: ezirmusitua <[email protected]> * fix rebase Signed-off-by: ezirmusitua <[email protected]> --------- Signed-off-by: ezirmusitua <[email protected]> Signed-off-by: alabulei1 <[email protected]> Signed-off-by: Michael Yuan <[email protected]> Signed-off-by: Michael Yuan <[email protected]> Co-authored-by: alabulei1 <[email protected]> Co-authored-by: Michael Yuan <[email protected]>
1 parent 3d89ec8 commit fc4aaab

31 files changed

+656
-643
lines changed

docs/contribute/plugin/intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ Due to the `OpenVINO` dependency, we only release the WASI-NN plug-in for the `O
9494
[wasmedge_process_interface]: https://crates.io/crates/wasmedge_process_interface
9595
[wasmedge_tensorflow_interface]: https://crates.io/crates/wasmedge_tensorflow_interface
9696
[wasi-crypto]: https://crates.io/crates/wasi-crypto
97-
[wasi-nn]: https://crates.io/crates/wasi-nn
97+
[wasi-nn]: https://crates.io/crates/wasi-nn

docs/start/wasmedge/extensions/plugins.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ The latest version supporting the extensions is `0.12.1`. This chapter will be d
3535
| Extension | Description | Platform Support | Language support |
3636
| --- | --- | --- | --- |
3737
| [Image processing](https://github.com/second-state/WasmEdge-image) | A native library to manipulate images for AI inference tasks. Migrated into the plug-in after WasmEdge `0.13.0`. | `manylinux2014 x86_64`, `manylinux2014 aarch64`, `android aarch64`, `ubuntu 20.04 x86_64`, and `darwin x86_64` | [Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |
38-
| [TensorFlow and Tensorflow-Lite](https://github.com/second-state/WasmEdge-tensorflow) | A native library to inferring TensorFlow and TensorFlow-Lite models. Migrated into the plug-in after WasmEdge `0.13.0`. | `manylinux2014 x86_64`, `manylinux2014 aarch64` (TensorFlow-Lite only), `android aarch64` (TensorFlow-Lite only), `ubuntu 20.04 x86_64`, and `darwin x86_64` | [Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |
38+
| [TensorFlow and Tensorflow-Lite](https://github.com/second-state/WasmEdge-tensorflow) | A native library to inferring TensorFlow and TensorFlow-Lite models. Migrated into the plug-in after WasmEdge `0.13.0`. | `manylinux2014 x86_64`, `manylinux2014 aarch64` (TensorFlow-Lite only), `android aarch64` (TensorFlow-Lite only), `ubuntu 20.04 x86_64`, and `darwin x86_64` | [Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.2.2) |

i18n/zh/docusaurus-plugin-content-docs/current/contribute/plugin/intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ Due to the `OpenVINO` dependency, we only release the WASI-NN plug-in for the `O
9494
[wasmedge_process_interface]: https://crates.io/crates/wasmedge_process_interface
9595
[wasmedge_tensorflow_interface]: https://crates.io/crates/wasmedge_tensorflow_interface
9696
[wasi-crypto]: https://crates.io/crates/wasi-crypto
97-
[wasi-nn]: https://crates.io/crates/wasi-nn
97+
[wasi-nn]: https://crates.io/crates/wasi-nn
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"label": "Running with WasmEdge",
2+
"label": "运行 WasmEdge",
33
"position": 5,
44
"link": {
55
"type": "generated-index",
6-
"description": "In this chapter, we will discuss WasmEdge CLIs and how to leverage Docker + WASM to run build, share, and run your WASM apps."
6+
"description": "在这一章节中,我们将讨论 WasmEdge CLIs(命令行界面)以及如何利用 Docker WASM 来构建、分享和运行你的 WASM 应用程序。"
77
}
88
}

i18n/zh/docusaurus-plugin-content-docs/current/start/build-and-run/aot.md

+59-60
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
sidebar_position: 3
33
---
44

5-
# The AoT Compiler
5+
# AoT 编译器
66

7-
After [installation](../install.md#install), users can execute the `wasmedge compile` command.
7+
安装完成后(请参阅[安装指南](../install.md#install)),用户可以执行 `wasmedge compile` 命令。
88

9-
The usage of the `wasmedge compile` command will be:
9+
`wasmedge compile` 命令的用法如下:
1010

1111
```bash
1212
$ wasmedge compile -h
@@ -16,61 +16,60 @@ USAGE
1616
...
1717
```
1818

19-
The `wasmedge compile` command can compile WebAssembly into native machine code (i.e., the AOT compiler). For the pure WebAssembly, the `wasmedge` tool will execute the WASM in interpreter mode. After compiling with the `wasmedge compile` AOT compiler, the `wasmedge` tool can execute the WASM in AOT mode, which is much faster.
20-
21-
## Options
22-
23-
The options of the `wasmedge compile` command are as follows.
24-
25-
1. `-h|--help`: Show the help messages. Will ignore the other arguments below.
26-
2. _(Optional)_ `--dump`: Dump the LLVM IR to `wasm.ll` and `wasm-opt.ll`.
27-
3. _(Optional)_ `--interruptible`: Generate the binary which supports interruptible execution.
28-
- By default, the AOT-compiled WASM not supports [interruptions in asynchronous executions](../../embed/c/reference/0.12.x#async).
29-
4. _(Optional)_ Statistics information:
30-
- By default, the AOT-compiled WASM not supports all statistics even if the options are turned on when running the `wasmedge` tool.
31-
- Use `--enable-time-measuring` to generate code for enabling time-measuring statistics in execution.
32-
- Use `--enable-gas-measuring` to generate code for enabling the statistics of gas measuring in execution.
33-
- Use `--enable-instruction-count` to generate code for enabling the statistics of counting WebAssembly instructions.
34-
- Or use `--enable-all-statistics` to generate code for enabling all of the statistics.
35-
5. _(Optional)_ `--generic-binary`: Generate the generic binary of the current host CPU architecture.
36-
6. _(Optional)_ WebAssembly proposals:
37-
- Use `--disable-import-export-mut-globals` to disable the [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global) proposal (Default `ON`).
38-
- Use `--disable-non-trap-float-to-int` to disable the [Non-Trapping Float-to-Int Conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) proposal (Default `ON`).
39-
- Use `--disable-sign-extension-operators` to disable the [Sign-Extension Operators](https://github.com/WebAssembly/sign-extension-ops) proposal (Default `ON`).
40-
- Use `--disable-multi-value` to disable the [Multi-value](https://github.com/WebAssembly/multi-value) proposal (Default `ON`).
41-
- Use `--disable-bulk-memory` to disable the [Bulk Memory Operations](https://github.com/WebAssembly/bulk-memory-operations) proposal (Default `ON`).
42-
- Use `--disable-reference-types` to disable the [Reference Types](https://github.com/WebAssembly/reference-types) proposal (Default `ON`).
43-
- Use `--disable-simd` to disable the [Fixed-width SIMD](https://github.com/webassembly/simd) proposal (Default `ON`).
44-
- Use `--enable-multi-memory` to enable the [Multiple Memories](https://github.com/WebAssembly/multi-memory) proposal (Default `OFF`).
45-
- Use `--enable-tail-call` to enable the [Tail call](https://github.com/WebAssembly/tail-call) proposal (Default `OFF`).
46-
- Use `--enable-extended-const` to enable the [Extended Constant Expressions](https://github.com/WebAssembly/extended-const) proposal (Default `OFF`).
47-
- Use `--enable-threads` to enable the [Threads](https://github.com/webassembly/threads) proposal (Default `OFF`).
48-
- Use `--enable-all` to enable ALL proposals above.
49-
7. _(Optional)_ `--optimize`: Select the LLVM optimization level.
50-
- Use `--optimize LEVEL` to set the optimization level. The `LEVEL` should be one of `0`, `1`, `2`, `3`, `s`, or `z`.
51-
- The default value will be `2`, which means `O2`.
52-
8. Input WASM file (`/path/to/wasm/file`).
53-
9. Output path (`/path/to/output/file`).
54-
- By default, the `wasmedge compile` command will output the [universal WASM format](#output-format-universal-wasm).
55-
- If the specific file extension (`.so` on Linux, `.dylib` on MacOS, and `.dll` on Windows) is assigned in the output path, the `wasmedge compile` command will output the [shared library format](#output-format-shared-library).
56-
57-
## Example
58-
59-
We created the hand-written [fibonacci.wat](https://github.com/WasmEdge/WasmEdge/raw/master/examples/wasm/fibonacci.wat) and used the [wat2wasm](https://webassembly.github.io/wabt/demo/wat2wasm/) tool to convert it into the `fibonacci.wasm` WebAssembly program. Take it, for example. It exported a `fib()` function, which takes a single `i32` integer as the input parameter.
60-
61-
You can run:
19+
`wasmedge compile` 命令可将 WebAssembly 编译为本机机器码(即,AOT 编译器)。对于纯 WebAssembly,`wasmedge` 工具将以解释器模式执行 WASM。通过 `wasmedge compile` AOT 编译器编译后,`wasmedge` 工具可以以 AOT 模式执行 WASM,速度要快得多。
20+
21+
## 选项
22+
23+
`wasmedge compile` 命令的选项如下。
24+
25+
1. `-h|--help`:显示帮助信息。将忽略下面的其他参数。
26+
2. (可选)`--dump`:将 LLVM IR 转储到 `wasm.ll``wasm-opt.ll`
27+
3. (可选)`--interruptible`:生成支持可中断执行的二进制文件。
28+
- 默认情况下,AOT 编译的 WASM 不支持[异步执行中的中断](../../embed/c/reference/0.12.x#async)
29+
4. (可选)统计信息:
30+
- 默认情况下,即使在运行 `wasmedge` 工具时打开选项,AOT 编译的 WASM 也不支持所有统计信息。
31+
- 使用 `--enable-time-measuring` 生成用于启用执行时间测量统计的代码。
32+
- 使用 `--enable-gas-measuring` 生成用于启用执行中的 gas 测量统计的代码。
33+
- 使用 `--enable-instruction-count` 生成用于启用 WebAssembly 指令计数统计的代码。
34+
5. (可选)`--generic-binary`:生成通用二进制文件。
35+
6. (可选)WebAssembly 提案:
36+
- 使用 `--disable-import-export-mut-globals` 禁用[可变全局变量的导入/导出](https://github.com/WebAssembly/mutable-global) 提案(默认为 `ON`)。
37+
- 使用 `--disable-non-trap-float-to-int` 禁用[非陷阱浮点到整数转换](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) 提案(默认为 `ON`)。
38+
- 使用 `--disable-sign-extension-operators` 禁用[符号扩展运算符](https://github.com/WebAssembly/sign-extension-ops) 提案(默认为 `ON`)。
39+
- 使用 `--disable-multi-value` 禁用[多值](https://github.com/WebAssembly/multi-value) 提案(默认为 `ON`)。
40+
- 使用 `--disable-bulk-memory` 禁用[批量内存操作](https://github.com/WebAssembly/bulk-memory-operations) 提案(默认为 `ON`)。
41+
- 使用 `--disable-reference-types` 禁用[引用类型](https://github.com/WebAssembly/reference-types) 提案(默认为 `ON`)。
42+
- 使用 `--disable-simd` 禁用[固定宽度 SIMD](https://github.com/webassembly/simd) 提案(默认为 `ON`)。
43+
- 使用 `--enable-multi-memory` 启用[多内存](https://github.com/WebAssembly/multi-memory) 提案(默认为 `OFF`)。
44+
- 使用 `--enable-tail-call` 启用[尾调用](https://github.com/WebAssembly/tail-call) 提案(默认为 `OFF`)。
45+
- 使用 `--enable-extended-const` 启用[扩展常量表达式](https://github.com/WebAssembly/extended-const) 提案(默认为 `OFF`)。
46+
- 使用 `--enable-threads` 启用[线程](https://github.com/webassembly/threads) 提案(默认为 `OFF`)。
47+
- 使用 `--enable-all` 启用上述所有提案。
48+
7. (可选)`--optimize`:选择 LLVM 优化级别。
49+
- 使用 `--optimize LEVEL` 来设置优化级别。`LEVEL` 应为 `0``1``2``3``s``z` 中的一个。
50+
- 默认值为 `2`,即 `O2`
51+
8. 输入的 WASM 文件(`/path/to/wasm/file`)。
52+
9. 输出路径(`/path/to/output/file`)。
53+
- 默认情况下,`wasmedge compile` 命令将输出[通用的 WASM 格式](#output-format-universal-wasm)
54+
- 如果在输出路径中指定了特定的文件扩展名(在 Linux 上为 `.so`,在 MacOS 上为 `.dylib`,在 Windows 上为 `.dll`),`wasmedge compile` 命令将输出[共享库格式](#output-format-shared-library)
55+
56+
## 示例
57+
58+
我们创建了纯手工编写的 [fibonacci.wat](https://github.com/WasmEdge/WasmEdge/raw/master/examples/wasm/fibonacci.wat) 并使用 [wat2wasm](https://webassembly.github.io/wabt/demo/wat2wasm/) 工具将其转换为 `fibonacci.wasm` WebAssembly 程序。以此为例,将它导出为一个接收单个 `i32` 整数作为输入参数的 `fib()` 函数。
59+
60+
你可以执行:
6261

6362
```bash
6463
wasmedge compile fibonacci.wasm fibonacci_aot.wasm
6564
```
6665

67-
or:
66+
或者:
6867

6968
```bash
70-
wasmedge compile fibonacci.wasm fibonacci_aot.so # On Linux.
69+
wasmedge compile fibonacci.wasm fibonacci_aot.so # Linux
7170
```
7271

73-
The output will be:
72+
输出将会是:
7473

7574
```bash
7675
[2022-09-09 14:22:10.540] [info] compile start
@@ -81,13 +80,13 @@ The output will be:
8180
[2022-09-09 14:22:10.600] [info] compile done
8281
```
8382

84-
Then you can execute the output file with `wasmedge` and measure the execution time:
83+
然后,你可以使用 `wasmedge` 执行输出文件并测量执行时间:
8584

8685
```bash
8786
time wasmedge --reactor fibonacci_aot.wasm fib 30
8887
```
8988

90-
The output will be:
89+
输出将会是:
9190

9291
```bash
9392
1346269
@@ -97,13 +96,13 @@ user 0m0.012s
9796
sys 0m0.014s
9897
```
9998

100-
Then you can compare it with the interpreter mode:
99+
接着,你可以与解释器模式进行比较:
101100

102101
```bash
103102
time wasmedge --reactor fibonacci.wasm fib 30
104103
```
105104

106-
The output shows that the AOT-compiled WASM is much faster than the interpreter mode:
105+
输出显示,AOT 编译的 WASM 比解释器模式快得多:
107106

108107
```bash
109108
1346269
@@ -113,27 +112,27 @@ user 0m0.427s
113112
sys 0m0.012s
114113
```
115114

116-
## Output Format: Universal WASM
115+
## 输出格式:通用 WASM
117116

118-
By default, the `wasmedge compile` AOT compiler tool could wrap the AOT-compiled native binary into a custom section in the origin WASM file. We call this the universal WASM binary format.
117+
默认情况下,`wasmedge compile` AOT 编译器工具可以将 AOT 编译的本机二进制文件包装为原始 WASM 文件中的自定义部分。我们称其为通用 WASM 二进制格式。
119118

120-
This AOT-compiled WASM file is compatible with any WebAssembly runtime. However, when this WASM file is executed by the WasmEdge runtime, WasmEdge will extract the native binary from the custom section and execute it in AOT mode.
119+
这个 AOT 编译的 WASM 文件与所有的 WebAssembly runtime 兼容。但是,当 WasmEdge runtime 执行此 WASM 文件时,WasmEdge 将从自定义部分提取本机二进制并以 AOT 模式执行它。
121120

122121
<!-- prettier-ignore -->
123122
:::note
124-
On MacOS platforms, the universal WASM format will `bus error` in execution. By default, the `wasmedge compile` tool optimizes the WASM in the `O2` level. We are trying to fix this issue. For working around, please use the shared library output format instead.
123+
MacOS 平台上,通用 WASM 格式在执行时会产生 `bus error`。默认情况下,`wasmedge compile` 工具会以 `O2` 级别优化 WASM。我们正在尝试解决此问题。请使用共享库输出格式以暂时解决此问题。
125124
:::
126125

127126
```bash
128127
wasmedge compile app.wasm app_aot.wasm
129128
wasmedge app_aot.wasm
130129
```
131130

132-
## Output Format: Shared Library
131+
## 输出格式:共享库
133132

134-
Users can assign the shared library extension for the output files (`.so` on Linux, `.dylib` on MacOS, and `.dll` on Windows) to generate the shared library output format output.
133+
用户可以为输出文件指定共享库扩展名(在 Linux 上为 `.so`,在 MacOS 上为 `.dylib`,在 Windows 上为 `.dll`),以生成共享库格式的输出。
135134

136-
This AOT-compiled WASM file is only for WasmEdge use and cannot be used by other WebAssembly runtimes.
135+
这个 AOT 编译的 WASM 文件仅供 WasmEdge 使用,其他 WebAssembly runtime 无法使用。
137136

138137
```bash
139138
wasmedge compile app.wasm app_aot.so

0 commit comments

Comments
 (0)