Skip to content

Commit 1ec3045

Browse files
author
LittleMouse
committed
[update] add llm_llm2
1 parent d8f3ab4 commit 1ec3045

41 files changed

Lines changed: 32084 additions & 5 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎ext_components/SimpleCV/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
menuconfig AX_SIMPLECV_ENABLED
2+
bool "Enable SimpleCV support"
3+
default n
4+
help
5+
enable SimpleCV support

‎ext_components/SimpleCV/SConstruct‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# component2/SConscript
2+
Import("env")
3+
import os
4+
from pathlib import Path
5+
6+
with open(env["PROJECT_TOOL_S"]) as f:
7+
exec(f.read())
8+
9+
_SDK_PATH = os.path.normpath(
10+
os.environ.get("SDK_PATH", str(Path(os.getcwd()) / ".." / ".."))
11+
)
12+
13+
env["GIT_REPO_LISTS"]["SimpleCV"] = {
14+
"url": "https://github.com/ZHEQIUSHUI/SimpleCV.git",
15+
"commit": "7729953c7c75ffaea441f70e0a9eb62790f3eb2b",
16+
"path": str(Path(_SDK_PATH) / "github_source" / "SimpleCV"),
17+
}
18+
19+
if "CONFIG_AX_SIMPLECV_ENABLED" in os.environ:
20+
check_component("SimpleCV")
21+
SRCS = []
22+
INCLUDE = []
23+
PRIVATE_INCLUDE = []
24+
REQUIREMENTS = []
25+
STATIC_LIB = []
26+
DYNAMIC_LIB = []
27+
DEFINITIONS = []
28+
DEFINITIONS_PRIVATE = []
29+
LDFLAGS = []
30+
LINK_SEARCH_PATH = []
31+
32+
INCLUDE += [
33+
os.path.join(env["GIT_REPO_LISTS"]["SimpleCV"]["path"], "include"),
34+
]
35+
36+
env["COMPONENTS"].append(
37+
{
38+
"target": os.path.basename(env["component_dir"]),
39+
"SRCS": SRCS,
40+
"INCLUDE": INCLUDE,
41+
"PRIVATE_INCLUDE": PRIVATE_INCLUDE,
42+
"REQUIREMENTS": REQUIREMENTS,
43+
"STATIC_LIB": STATIC_LIB,
44+
"DYNAMIC_LIB": DYNAMIC_LIB,
45+
"DEFINITIONS": DEFINITIONS,
46+
"DEFINITIONS_PRIVATE": DEFINITIONS_PRIVATE,
47+
"LDFLAGS": LDFLAGS,
48+
"LINK_SEARCH_PATH": LINK_SEARCH_PATH,
49+
"REGISTER": "static",
50+
}
51+
)

‎ext_components/openai-api/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
menuconfig AX_OPENAI_API_ENABLED
2+
bool "Enable openai-api support"
3+
default n
4+
help
5+
enable openai-api support
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# component2/SConscript
2+
Import("env")
3+
import os
4+
from pathlib import Path
5+
6+
with open(env["PROJECT_TOOL_S"]) as f:
7+
exec(f.read())
8+
9+
_SDK_PATH = os.path.normpath(
10+
os.environ.get("SDK_PATH", str(Path(os.getcwd()) / ".." / ".."))
11+
)
12+
13+
env["GIT_REPO_LISTS"]["openai-api"] = {
14+
"url": "https://github.com/ZHEQIUSHUI/openai-api.cpp.git",
15+
"commit": "127f3e75054a733ca1b903ff1f8ec600b90cb6b0",
16+
"path": str(Path(_SDK_PATH) / "github_source" / "openai-api.cpp"),
17+
}
18+
19+
if "CONFIG_AX_OPENAI_API_ENABLED" in os.environ:
20+
check_component("openai-api")
21+
SRCS = []
22+
INCLUDE = []
23+
PRIVATE_INCLUDE = []
24+
REQUIREMENTS = []
25+
STATIC_LIB = []
26+
DYNAMIC_LIB = []
27+
DEFINITIONS = []
28+
DEFINITIONS_PRIVATE = []
29+
LDFLAGS = []
30+
LINK_SEARCH_PATH = []
31+
32+
INCLUDE += [
33+
os.path.join(env["GIT_REPO_LISTS"]["openai-api"]["path"], "include"),
34+
]
35+
36+
env["COMPONENTS"].append(
37+
{
38+
"target": os.path.basename(env["component_dir"]),
39+
"SRCS": SRCS,
40+
"INCLUDE": INCLUDE,
41+
"PRIVATE_INCLUDE": PRIVATE_INCLUDE,
42+
"REQUIREMENTS": REQUIREMENTS,
43+
"STATIC_LIB": STATIC_LIB,
44+
"DYNAMIC_LIB": DYNAMIC_LIB,
45+
"DEFINITIONS": DEFINITIONS,
46+
"DEFINITIONS_PRIVATE": DEFINITIONS_PRIVATE,
47+
"LDFLAGS": LDFLAGS,
48+
"LINK_SEARCH_PATH": LINK_SEARCH_PATH,
49+
"REGISTER": "static",
50+
}
51+
)

‎ext_components/tokenizer/SConstruct‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ _SDK_PATH = os.path.normpath(
1212

1313
env["GIT_REPO_LISTS"]["tokenizer"] = {
1414
"url": "https://github.com/ZHEQIUSHUI/tokenizer.git",
15-
"commit": "83f41d4b5b9a135c167d44fcdf2a0c56ebacca6d",
15+
"commit": "109a37cf70d1891e0dc41c39261dabb70d8a4fce",
1616
"path": str(Path(_SDK_PATH) / "github_source" / "tokenizer"),
1717
}
1818

@@ -32,7 +32,6 @@ if "CONFIG_AX_TOKENIZER_ENABLED" in os.environ:
3232
INCLUDE += [
3333
os.path.join(env["GIT_REPO_LISTS"]["tokenizer"]["path"], "include"),
3434
]
35-
print("AX-TOKENIZER INCLUDE:", INCLUDE)
3635

3736
env["COMPONENTS"].append(
3837
{

‎projects/llm_framework/SConstruct‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import shutil
55
os.environ['SDK_PATH'] = os.path.normpath(str(Path(os.getcwd())/'..'/'..'/'SDK'))
66
os.environ['EXT_COMPONENTS_PATH'] = os.path.normpath(str(Path(os.getcwd())/'..'/'..'/'ext_components'))
77

8-
version = 'v0.1.5'
8+
version = 'v0.1.6'
99
static_lib = 'static_lib'
1010
update = False
1111

‎projects/llm_framework/config_defaults.mk‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ CONFIG_LHV_WITH_EVPP=y
2020
CONFIG_STACKFLOW_ENABLED=y
2121
CONFIG_UTILITIES_BASE64_ENABLED=y
2222
CONFIG_SINGLE_HEADER_LIBS_ENABLED=y
23+
CONFIG_AX_OPENAI_API_ENABLED=y
2324
CONFIG_AX_SAMPLES_ENABLED=y
25+
CONFIG_AX_SIMPLECV_ENABLED=y
26+
CONFIG_AX_TOKENIZER_ENABLED=y
2427
CONFIG_SIMDJSON_COMPENENT_ENABLED=y
2528
CONFIG_SAMPLE_COMMON_ENABLED=y
2629
CONFIG_MODBUS_ENABLED=y

‎projects/llm_framework/main_llm2/Kconfig‎

Whitespace-only changes.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import os
2+
3+
Import('env')
4+
with open(env['PROJECT_TOOL_S']) as f:
5+
exec(f.read())
6+
7+
8+
SRCS = append_srcs_dir(ADir('src'))
9+
INCLUDE = [ADir('include'), ADir('.')]
10+
PRIVATE_INCLUDE = [ADir('../include')]
11+
REQUIREMENTS = ['pthread','atomic','rt', 'dl', 'm', 'ax_msp', 'utilities', 'eventpp', 'StackFlow', 'tokenizer', 'openai-api', 'SimpleCV']
12+
STATIC_LIB = []
13+
DYNAMIC_LIB = []
14+
DEFINITIONS = []
15+
DEFINITIONS_PRIVATE = []
16+
LDFLAGS = []
17+
LINK_SEARCH_PATH = []
18+
STATIC_FILES = []
19+
20+
DEFINITIONS += ['-O2']
21+
DEFINITIONS += ['-std=c++17']
22+
LDFLAGS+=['-Wl,-rpath=/opt/m5stack/lib', '-Wl,-rpath=/usr/local/m5stack/lib', '-Wl,-rpath=/usr/local/m5stack/lib/gcc-10.3', '-Wl,-rpath=/opt/lib', '-Wl,-rpath=/opt/usr/lib', '-Wl,-rpath=./']
23+
REQUIREMENTS += ['ax_engine', 'ax_interpreter', 'ax_sys', 'utilities']
24+
LINK_SEARCH_PATH += [ADir('../static_lib')]
25+
26+
27+
INCLUDE += [ADir('src/runner'), ADir('src/runner/utils'), ADir('src/runner/ax_model_runner]'), ADir('src/runner/magic_enum/include')]
28+
STATIC_LIB += [AFile('../static_lib/libopenai_api.a'), AFile('../static_lib/libsimplecv.a'), AFile('../static_lib/libtokenizer.a')]
29+
30+
STATIC_FILES += Glob('models/mode_*.json')
31+
32+
IGNORE_FILES = []
33+
IGNORE_FILES += ['llm']
34+
35+
import json
36+
if not os.path.exists('../dist'):
37+
os.makedirs('../dist')
38+
ignore = {'ignore':[]}
39+
try:
40+
with open('../dist/fileignore', 'a+') as f:
41+
f.seek(0)
42+
ignore = json.load(f)
43+
except:
44+
pass
45+
ignore['ignore'] += IGNORE_FILES
46+
ignore['ignore'] = list(set(ignore['ignore']))
47+
with open('../dist/fileignore', 'w') as f:
48+
json.dump(ignore, f, indent=4)
49+
50+
env['COMPONENTS'].append({'target':'llm_llm2-1.12',
51+
'SRCS':SRCS,
52+
'INCLUDE':INCLUDE,
53+
'PRIVATE_INCLUDE':PRIVATE_INCLUDE,
54+
'REQUIREMENTS':REQUIREMENTS,
55+
'STATIC_LIB':STATIC_LIB,
56+
'DYNAMIC_LIB':DYNAMIC_LIB,
57+
'DEFINITIONS':DEFINITIONS,
58+
'DEFINITIONS_PRIVATE':DEFINITIONS_PRIVATE,
59+
'LDFLAGS':LDFLAGS,
60+
'LINK_SEARCH_PATH':LINK_SEARCH_PATH,
61+
'STATIC_FILES':STATIC_FILES,
62+
'REGISTER':'project'
63+
})
64+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"mode": "Qwen3-0.6B-ax650",
3+
"type": "llm",
4+
"homepage": "https://huggingface.co/AXERA-TECH/Qwen3-0.6B",
5+
"capabilities": [
6+
"text_generation",
7+
"chat"
8+
],
9+
"input_type": [
10+
"llm.utf-8",
11+
"llm.utf-8.stream",
12+
"llm.chat_completion",
13+
"llm.chat_completion.stream"
14+
],
15+
"output_type": [
16+
"llm.utf-8",
17+
"llm.utf-8.stream"
18+
],
19+
"mode_param": {
20+
"system_prompt": "you are a helpful assistant.",
21+
"model_name": "Qwen3-0.6B-ax650",
22+
"template_filename_axmodel": "qwen3_p128_l%d_together.axmodel",
23+
"axmodel_num": 28,
24+
"filename_post_axmodel": "qwen3_post.axmodel",
25+
"post_config_path": "post_config.json",
26+
"tokenizer_type": "Qwen3",
27+
"url_tokenizer_model": "qwen3_tokenizer.txt",
28+
"filename_tokens_embed": "model.embed_tokens.weight.bfloat16.bin",
29+
"tokens_embed_num": 151936,
30+
"tokens_embed_size": 1024,
31+
"b_use_mmap_load_embed": true,
32+
"b_use_mmap_load_layer": true
33+
}
34+
}

0 commit comments

Comments
 (0)