1+ /* Copyright 2025 The xLLM Authors. All Rights Reserved.
2+ Licensed under the Apache License, Version 2.0 (the "License");
3+ you may not use this file except in compliance with the License.
4+ You may obtain a copy of the License at
5+ https://github.com/jd-opensource/xllm/blob/main/LICENSE
6+ Unless required by applicable law or agreed to in writing, software
7+ distributed under the License is distributed on an "AS IS" BASIS,
8+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+ See the License for the specific language governing permissions and
10+ limitations under the License.
11+ ==============================================================================*/
12+ #pragma once
13+ #include " npu/npu_glm4_decoder_layer_impl.h"
14+ namespace xllm {
15+ namespace layer {
16+ #if defined(USE_NPU)
17+ class Glm4DecoderLayer
18+ : public torch::nn::ModuleHolder<NpuGlm4DecoderLayerImpl> {
19+ public:
20+ using torch::nn::ModuleHolder<NpuGlm4DecoderLayerImpl>::ModuleHolder;
21+ using Impl __attribute__ ((__unused__)) = NpuGlm4DecoderLayerImpl;
22+ Glm4DecoderLayer (const ModelContext& context)
23+ : ModuleHolder(std::make_shared<NpuGlm4DecoderLayerImpl>(context)) {}
24+ };
25+ #else
26+ class Glm4DecoderLayer : public torch ::nn::ModuleHolder<Qwen2DecoderImpl> {
27+ public:
28+ using torch::nn::ModuleHolder<Qwen2DecoderImpl>::ModuleHolder;
29+ using Impl __attribute__ ((__unused__)) = Qwen2DecoderImpl;
30+ Glm4DecoderLayer (const ModelContext& context)
31+ : ModuleHolder(std::make_shared<Qwen2DecoderImpl>(context)) {}
32+ };
33+ #endif
34+ } // namespace layer
35+ } // namespace xllm
0 commit comments