File size: 2,311 Bytes
6485c4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/src/models/qwen3.cpp b/src/models/qwen3.cpp
index d271b555e..024b043a6 100644
--- a/src/models/qwen3.cpp
+++ b/src/models/qwen3.cpp
@@ -173,12 +173,17 @@ llama_model_qwen3::graph::graph(const llama_model & model, const llm_graph_param
                 LLM_NORM_RMS, il);
         cb(cur, "ffn_norm", il);
 
-        if (model.layers[il].ffn_gate_norm_in) {
+        if (model.layers[il].ffn_gate_norm_in ||
+            model.layers[il].ffn_up_norm_in   ||
+            model.layers[il].ffn_down_norm_in) {
             // BitNet per-projection norms for MLP
-            ggml_tensor * gate_inp = build_norm(cur,
-                    model.layers[il].ffn_gate_norm_in, NULL,
-                    LLM_NORM_RMS, il);
-            cb(gate_inp, "ffn_gate_norm_in", il);
+            ggml_tensor * gate_inp = cur;
+            if (model.layers[il].ffn_gate_norm_in) {
+                gate_inp = build_norm(cur,
+                        model.layers[il].ffn_gate_norm_in, NULL,
+                        LLM_NORM_RMS, il);
+                cb(gate_inp, "ffn_gate_norm_in", il);
+            }
 
             ggml_tensor * up_inp = cur;
             if (model.layers[il].ffn_up_norm_in) {
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 780df3266..55cbc2b54 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -21,10 +21,10 @@ else()
     add_subdirectory(completion)
     add_subdirectory(perplexity)
     add_subdirectory(quantize)
+    add_subdirectory(server)
+    add_subdirectory(cli)
     if (LLAMA_BUILD_SERVER)
         add_subdirectory(ui)
-        add_subdirectory(cli)
-        add_subdirectory(server)
     endif()
     add_subdirectory(tokenize)
     add_subdirectory(parser)
diff --git a/tools/server/CMakeLists.txt b/tools/server/CMakeLists.txt
index b5c40884f..fb1f7220b 100644
--- a/tools/server/CMakeLists.txt
+++ b/tools/server/CMakeLists.txt
@@ -33,6 +33,7 @@ target_link_libraries(${TARGET} PUBLIC llama-common mtmd ${CMAKE_THREAD_LIBS_INI
 
 # llama-server-impl: server logic, reusable by app
 
+if (LLAMA_BUILD_SERVER)
 set(TARGET llama-server-impl)
 
 add_library(${TARGET}
@@ -61,3 +62,4 @@ install(TARGETS ${TARGET} RUNTIME)
 
 target_link_libraries(${TARGET} PRIVATE llama-server-impl)
 target_compile_features(${TARGET} PRIVATE cxx_std_17)
+endif()