ipex-llm 2.2.0b20250101__py3-none-manylinux2010_x86_64.whl → 2.2.0b20250103__py3-none-manylinux2010_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ipex_llm/optimize.py +3 -1
- ipex_llm/transformers/convert.py +6 -12
- ipex_llm/transformers/low_bit_linear.py +8 -2
- ipex_llm/transformers/model.py +3 -1
- ipex_llm/transformers/models/baichuan.py +5 -11
- ipex_llm/transformers/models/chatglm.py +2 -2
- ipex_llm/transformers/models/qwen.py +34 -46
- ipex_llm/transformers/models/qwen2.py +5 -19
- ipex_llm/transformers/models/yuan.py +2 -50
- ipex_llm/transformers/npu_model.py +3 -3
- ipex_llm/transformers/npu_models/convert.py +40 -18
- ipex_llm/transformers/npu_models/npu_llm_cpp.py +18 -9
- ipex_llm/transformers/npu_pipeline_model/qwen.py +4 -0
- ipex_llm/transformers/xpu_ops.py +155 -0
- ipex_llm/utils/__init__.py +1 -2
- ipex_llm/utils/benchmark_util_4_47.py +4907 -0
- ipex_llm/vllm/xpu/model_convert.py +2 -0
- {ipex_llm-2.2.0b20250101.dist-info → ipex_llm-2.2.0b20250103.dist-info}/METADATA +19 -19
- {ipex_llm-2.2.0b20250101.dist-info → ipex_llm-2.2.0b20250103.dist-info}/RECORD +25 -23
- {ipex_llm-2.2.0b20250101.data → ipex_llm-2.2.0b20250103.data}/scripts/ipex-llm-init +0 -0
- {ipex_llm-2.2.0b20250101.data → ipex_llm-2.2.0b20250103.data}/scripts/llm-chat +0 -0
- {ipex_llm-2.2.0b20250101.data → ipex_llm-2.2.0b20250103.data}/scripts/llm-cli +0 -0
- {ipex_llm-2.2.0b20250101.dist-info → ipex_llm-2.2.0b20250103.dist-info}/WHEEL +0 -0
- {ipex_llm-2.2.0b20250101.dist-info → ipex_llm-2.2.0b20250103.dist-info}/entry_points.txt +0 -0
- {ipex_llm-2.2.0b20250101.dist-info → ipex_llm-2.2.0b20250103.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,155 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 The BigDL Authors.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
import torch
|
18
|
+
import xe_linear
|
19
|
+
import xe_batch
|
20
|
+
import xe_addons
|
21
|
+
|
22
|
+
|
23
|
+
@torch.library.register_fake("ipex_llm::forward_new")
|
24
|
+
def _(x, weight, qtype, input_size):
|
25
|
+
return torch.empty_like(x)
|
26
|
+
|
27
|
+
|
28
|
+
# @torch.library.register_fake("ipex_llm::dequant")
|
29
|
+
# def _(x, weight, qtype):
|
30
|
+
# return ???
|
31
|
+
|
32
|
+
|
33
|
+
@torch.library.register_fake("ipex_llm::mlp_forward_xpu")
|
34
|
+
def _(x, weight1, weight2, batch_size, state_size, output_size, act_type, qtype):
|
35
|
+
return torch.empty_like(x)
|
36
|
+
|
37
|
+
|
38
|
+
# @torch.library.register_fake("ipex_llm::rwkv_linear_attention_v4")
|
39
|
+
# def _(time_decay, time_first, key, value, num_state, den_state, max_state)
|
40
|
+
# return ???
|
41
|
+
|
42
|
+
|
43
|
+
# @torch.library.register_fake("ipex_llm::rwkv_linear_attention_v5")
|
44
|
+
# def _(time_decay, time_first, receptance, key, value, state)
|
45
|
+
# return ???
|
46
|
+
|
47
|
+
|
48
|
+
# @torch.library.register_fake("ipex_llm::rwkv_time_shift")
|
49
|
+
# def _(hidden, shifted, mix):
|
50
|
+
# return ???
|
51
|
+
|
52
|
+
|
53
|
+
# @torch.library.register_fake("ipex_llm::dequantize_rows")
|
54
|
+
# def _(x, weight, qtype, state_size, output_size):
|
55
|
+
# return ???
|
56
|
+
|
57
|
+
|
58
|
+
@torch.library.register_fake("ipex_llm::batch_forward")
|
59
|
+
def _(x, weight, qtype):
|
60
|
+
return torch.empty_like(x)
|
61
|
+
|
62
|
+
|
63
|
+
@torch.library.register_fake("ipex_llm::sdp")
|
64
|
+
def _(query, key, value, mask):
|
65
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
66
|
+
|
67
|
+
|
68
|
+
@torch.library.register_fake("ipex_llm::sdp_fp8")
|
69
|
+
def _(query, key, value, mask):
|
70
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
71
|
+
|
72
|
+
|
73
|
+
@torch.library.register_fake("ipex_llm::sdp_causal")
|
74
|
+
def _(query, key, value, mask, scale):
|
75
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
76
|
+
|
77
|
+
|
78
|
+
@torch.library.register_fake("ipex_llm::sdp_fp8_causal")
|
79
|
+
def _(query, key, value, mask, scale):
|
80
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
81
|
+
|
82
|
+
|
83
|
+
@torch.library.register_fake("ipex_llm::sdp_non_causal")
|
84
|
+
def _(query, key, value, mask, scale):
|
85
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
86
|
+
|
87
|
+
|
88
|
+
@torch.library.register_fake("ipex_llm::sdp_fp8_non_causal")
|
89
|
+
def _(query, key, value, mask, scale):
|
90
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
91
|
+
|
92
|
+
|
93
|
+
@torch.library.register_fake("ipex_llm::siglip_sdp_non_causal")
|
94
|
+
def _(query, key, value, mask):
|
95
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
96
|
+
|
97
|
+
|
98
|
+
@torch.library.register_fake("ipex_llm::gemma2_sdp")
|
99
|
+
def _(query, key, value, mask, f1, f2):
|
100
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
101
|
+
|
102
|
+
|
103
|
+
@torch.library.register_fake("ipex_llm::gemma2_sdp_causal")
|
104
|
+
def _(query, key, value, mask, f1, f2):
|
105
|
+
return torch.empty(query.shape, dtype=query.dtype, device=query.device)
|
106
|
+
|
107
|
+
|
108
|
+
@torch.library.register_fake("ipex_llm::rms_norm")
|
109
|
+
def _(weight, x, eps):
|
110
|
+
return torch.empty_like(x)
|
111
|
+
|
112
|
+
|
113
|
+
@torch.library.register_fake("ipex_llm::layer_norm")
|
114
|
+
def _(x, weight, bias, eps):
|
115
|
+
return torch.empty_like(x)
|
116
|
+
|
117
|
+
|
118
|
+
@torch.library.register_fake("ipex_llm::rotary_half_inplaced")
|
119
|
+
def _(inv_freq, position_ids, query, key):
|
120
|
+
pass
|
121
|
+
|
122
|
+
|
123
|
+
@torch.library.register_fake("ipex_llm::rotary_two_inplaced")
|
124
|
+
def _(inv_freq, position_ids, query, key):
|
125
|
+
pass
|
126
|
+
|
127
|
+
|
128
|
+
@torch.library.register_fake("ipex_llm::rotary_half_with_cache_inplaced")
|
129
|
+
def _(query, key, cos, sin):
|
130
|
+
pass
|
131
|
+
|
132
|
+
|
133
|
+
@torch.library.register_fake("ipex_llm::rotary_two_with_cache_inplaced")
|
134
|
+
def _(query, key, cos, sin, half_layout):
|
135
|
+
pass
|
136
|
+
|
137
|
+
|
138
|
+
@torch.library.register_fake("ipex_llm::mlp_silu_mul_inplaced")
|
139
|
+
def _(gate, up):
|
140
|
+
pass
|
141
|
+
|
142
|
+
|
143
|
+
@torch.library.register_fake("ipex_llm::quantize_key_value")
|
144
|
+
def _(key, value, key_output, value_output):
|
145
|
+
pass
|
146
|
+
|
147
|
+
|
148
|
+
@torch.library.register_fake("ipex_llm::dequantize_key_value")
|
149
|
+
def _(key, value, key_output, value_output):
|
150
|
+
pass
|
151
|
+
|
152
|
+
|
153
|
+
@torch.library.register_fake("ipex_llm::attn_softmax_inplaced")
|
154
|
+
def _(attn):
|
155
|
+
pass
|
ipex_llm/utils/__init__.py
CHANGED
@@ -23,8 +23,7 @@ import transformers
|
|
23
23
|
trans_version = transformers.__version__
|
24
24
|
|
25
25
|
if trans_version >= "4.47.0":
|
26
|
-
|
27
|
-
pass
|
26
|
+
from .benchmark_util_4_47 import BenchmarkWrapper
|
28
27
|
elif trans_version >= "4.45.0":
|
29
28
|
from .benchmark_util_4_45 import BenchmarkWrapper
|
30
29
|
elif trans_version >= "4.44.0":
|