File tree Expand file tree Collapse file tree 2 files changed +4
-27
lines changed
Expand file tree Collapse file tree 2 files changed +4
-27
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ add_library(ax_translate SHARED
4444 )
4545
4646add_executable (test_llm tests/test_llm.cpp)
47- target_link_libraries (test_llm PRIVATE ax_translate)
47+ target_link_libraries (test_llm PRIVATE ax_translate dl )
4848
4949add_executable (test_translate tests/test_translate.cpp)
50- target_link_libraries (test_translate PRIVATE ax_translate)
50+ target_link_libraries (test_translate PRIVATE ax_translate dl )
5151
5252install (TARGETS ax_translate
5353 LIBRARY DESTINATION lib
Original file line number Diff line number Diff line change 1- # opus-mt-en-zh- axera
2- 基于 [ opus-mt-en-zh ] ( https://huggingface.co/Helsinki-NLP/opus-mt-en-zh ) 模型的 英文->中文 翻译模型 。
1+ # Translate. axera
2+ 基于 [ Qwen/Qwen2.5-1.5B-Instruct ] ( https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct ) 模型的 实现多国语言互译 。
33
44## 编译
55``` shell
66./build.sh # 本地编译
77./build_aarch64.sh # aarch64 交叉编译
88```
99
10- ## 用例
11-
12- 详细代码见 [ test_translate.cpp] ( tests/test_translate.cpp )
13- ``` C++
14- std::string text = " Hello, Who are you" ;
15- std::string model_path = " opus-mt-en-zh.axmodel" ;
16- std::string tokenizer_dir = " tests/opus-mt-en-zh" ;
17-
18- Translator translator;
19- int ret = translator.Init(model_path, tokenizer_dir);
20- if (ret != 0 )
21- {
22- printf ("init translator failed\n");
23- return;
24- }
25- std::string output = translator.Translate(text);
26- printf ("output: %s\n", output.c_str()); // 你好,你是谁
27- ```
28-
29- ## 参考资料
30- * [sentencepiece](https://github.com/google/sentencepiece)
31- * [opus-mt-en-zh](https://huggingface.co/Helsinki-NLP/opus-mt-en-zh)
32-
3310## 社区
3411QQ 群: 139953715
You can’t perform that action at this time.
0 commit comments