repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
neural-speed | github_2023 | cpp | 138 | intel | a32543254 | @@ -144,8 +147,14 @@ static bool llama_model_eval_internal(model_context* ctx, const model_input* inp
struct ne_tensor* embd = ne_new_tensor_1d(ctx0, NE_TYPE_I32, N, NE_SIZE_CALC);
ne_set_name(embd, "embd");
+ // uint32_t input_tokens[5] = {1, 5713, 3714, 264, 727};
+ // for (int i = 0; i < N; ++i) { | remove unuse code |
neural-speed | github_2023 | python | 138 | intel | Zhenzhong1 | @@ -1089,6 +1089,8 @@ def write_file_header(self, params: Params, file_type: NEFileType) -> None:
self.fout.write(struct.pack("i", params.ffn_hidden_size))
self.fout.write(struct.pack("i", 0))
+ self.fout.write(struct.pack("i", 0))
+ self.fout.write(struct.pack("i", 0)) | please also add these parameters in convert_quantized_llama.py and other convert_quantized_xxxx.py files. |
neural-speed | github_2023 | cpp | 138 | intel | yuchengliu1 | @@ -351,17 +354,67 @@ static bool llama_model_eval_internal(model_context* ctx, const model_input* inp
// cur = cur*ffn_norm(broadcasted)
cur = ne_mul(ctx0, cur, model.layers[il].norm[1]);
}
-
- if (bestla_fusion_FFN_SiLu_f32f32_support(model.layers[il].ffn[0]->data, model.layers[il].ffn[1... | Use bestla support function like `bestla_fusion_FFN_SiLu_f32f32_support` to judge if bestla support this fusion. |
neural-speed | github_2023 | cpp | 142 | intel | yuchengliu1 | @@ -298,19 +298,23 @@ static bool chatglm_model_eval_internal(model_context* ctx, const model_input* i
// mlp.forward
struct ne_tensor* mlp_output = ne_rms_norm(ctx0, hidden_states, hparams.rms_norm_eps);
- ne_set_name(mlp_output, "mlp_output");
- // mlp_output = ne_mul(ctx0, mlp_output, model.layers[... | `set_name` can be reserved. `ne_repeat` in `ne_mul` can be removed |
neural-speed | github_2023 | python | 102 | intel | DDEle | @@ -93,6 +93,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
extdir = ext_fullpath.parent.resolve()
output_dir = f"{extdir}{os.sep}"
+ NS_PROFILING_ENV = os.environ.get("NS_PROFILING", "OFF") | Put at top just like `NS_WITH_AVX2`? |
neural-speed | github_2023 | cpp | 137 | intel | airMeng | @@ -972,24 +1094,74 @@ class scale_track_max_t<ISA_T, float, float> {
// if (j < utils::padto(N, 64))
// memset(dst + i * p.ld_dst + j, 0, sizeof(*dst) * (utils::padto(N, 64) - j));
}
-#else
+ return BTLA_CODE::Success;
+ }
+#endif
+ template <bool HAS_ALIBI>
+ BTLA_CODE forward_(const SType*... | why not ```forward_2<HAS_ALIBI>(src, src_step, M_offset, N_offset, M, N, p)``` too? |
neural-speed | github_2023 | cpp | 137 | intel | airMeng | @@ -144,6 +187,80 @@ inline __m512 exp_ph_0_1(const __m512 x) {
}
#endif
+alignas(32) const uint32_t mask8[9][8]{ | why 9? |
neural-speed | github_2023 | cpp | 137 | intel | luoyu-intel | @@ -85,14 +92,34 @@ struct attn_fwd_args_t {
struct mha_problem_t {
int batch_size, head_num, heads_kv, head_size, sl_q, sl_kv;
};
-
-inline __m512 poly_scale_2nd_ps(const __m512 z, const __m512 f, const __m512 c0, const __m512 c1, const __m512 c2) {
+template <typename X_T, typename Z_T = X_T>
+inline X_T poly_sc... | how about moving them to bestla::kernel? And add kernel wrapper for them |
neural-speed | github_2023 | cpp | 119 | intel | DDEle | @@ -72,55 +72,49 @@ constexpr __ESIMD_ENS::lsc_data_size get_data_size(gpu::xetla::data_size ds) {
/// @brief lookup table for memory kind.
///
///
-constexpr __ESIMD_ENS::lsc_memory_kind get_memory_kind(
+constexpr sycl::ext::intel::esimd::memory_kind get_memory_kind( | Seems that we can use `__ESIMD_NS` (`include/common/core/common.hpp`) |
neural-speed | github_2023 | others | 136 | intel | airMeng | @@ -96,9 +96,28 @@ endif()
if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX)
+ add_compile_options(/wd4244 /wd4267) # possible loss of data
+ add_compile_options(/wd4305) # truncation from 'double' to 'float'
+ add_compile_options(/wd4018) # '>': signed/unsigned mismatch
+ add_c... | put them under ```cmake/Common.cmake``` |
neural-speed | github_2023 | others | 135 | intel | airMeng | @@ -0,0 +1,34 @@
+SET conda_env_name=windows_build_ns
+SET python_version=3.10
+cd ../../..
+
+FOR /F %%i IN ('conda info -e ^| find /c "%conda_env_name%"') do SET CONDA_COUNT=%%i
+if %CONDA_COUNT% EQU 0 (
+ CALL conda create python=%python_version% -y -n %conda_env_name%
+)
+
+IF %ERRORLEVEL% NEQ 0 (
+ echo "Cou... | / no new line |
neural-speed | github_2023 | cpp | 97 | intel | airMeng | @@ -0,0 +1,525 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | this is llama basically, can you reuse the code as much as possible? |
neural-speed | github_2023 | python | 97 | intel | intellinjun | @@ -0,0 +1,173 @@
+ | please add version information
Copyright (c) 2023 Intel Corporation |
neural-speed | github_2023 | cpp | 97 | intel | airMeng | @@ -56,11 +56,15 @@ static bool llama_model_eval_internal(model_context* ctx, const model_input* inp
const int N = inputs->n_tokens;
const int n_past = inputs->n_past;
const int n_total = inputs->n_total;
+
// enforce that the first token is BOS
+#ifndef CUSTOMED_MODEL
+ // customed model does NOT have the... | temp code for debuggind? |
neural-speed | github_2023 | python | 97 | intel | airMeng | @@ -103,6 +103,10 @@ def main(args_in: Optional[List[str]] = None) -> None:
fout.write(struct.pack("f", 10000.0)) # freq_base
fout.write(struct.pack("f", 1.0)) # rope_factor
+ fout.write(struct.pack("f", 0.0)) # config.json "rope_scaling.factor", not enabled
+ fout.write(struct.pack("i", 0)) # rop... | can you seperate into 2 pr, the first pr can focus on ```rope_scaling.factor``` |
neural-speed | github_2023 | cpp | 97 | intel | intellinjun | @@ -0,0 +1,200 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | why use if(1)? |
neural-speed | github_2023 | python | 110 | intel | DDEle | @@ -20,6 +20,7 @@
import math
import os
import pathlib
+import psutil | Do we need to add `psutil` to `scripts/requirements.txt`? |
neural-speed | github_2023 | python | 87 | intel | Zhenzhong1 | @@ -133,12 +133,9 @@ def main(args_in: Optional[List[str]] = None) -> None:
if is_win():
path = Path(args.build_dir, "./Bin/Release/run_{}.exe".format(model_name))
else:
- if args.one_click_run == "True":
- import neural_speed
- package_path = os.path.dirname(neural_speed... | Looks good~, but I'm not sure if somewhere else will get into this else branch.
> Tested with same commands provided in the README file, on diverse models requiring token access ID: llama2-7b, llama2-13b, llama2-70b. The script completes its executions as expected.
Could you please provide test commands? |
neural-speed | github_2023 | python | 92 | intel | zhenwei-intel | @@ -18,15 +18,12 @@
from typing import List, Optional
import subprocess
from transformers import AutoTokenizer
+import neural_speed | This script is used for running executable files in C++, assuming no dependency on Python packages neural_speed |
neural-speed | github_2023 | python | 92 | intel | a32543254 | @@ -100,19 +97,8 @@ def main(args_in: Optional[List[str]] = None) -> None:
args = parser.parse_args(args_in)
model_name = model_maps.get(args.model_name, args.model_name)
- if is_win():
- path = Path(args.build_dir, "./Bin/Release/quant_{}.exe".format(model_name))
- else:
- if args.one_c... | no need distinguish the windows and linux ? |
neural-speed | github_2023 | c | 109 | intel | DDEle | @@ -3036,7 +3037,9 @@ struct ne_tensor* ne_rope_impl(struct ne_context* ctx, struct ne_tensor* a, int
ne_scratch_load(ctx);
- float params[] = {freq_base, freq_scale};
+ /* what the diffrence of setting parameters in b->data and in op_parameters */
+ /* float and int are in different data ?? */ | No difference. The only difference is that `b->data` can set size case by case while op params have a shard max size as `NE_MAX_OP_PARAMS`. In addition, `->data` was used as a workaround before op_param came.
Remove / modify this comment if no further questions on this. |
neural-speed | github_2023 | others | 117 | intel | zhewang1-intc | @@ -139,6 +139,7 @@ if (NS_BTLA_UT)
endif()
include(FindOpenMP)
+set(BTLA_USE_OPENMP ON) | will this change affect your thread-pool for hybrid CPUs? @yuchengliu1 |
neural-speed | github_2023 | others | 113 | intel | airMeng | @@ -1,13 +1,13 @@
--extra-index-url https://download.pytorch.org/whl/cpu
-torch==2.1.0+cpu
-transformers
-numpy
-sentencepiece
-protobuf<3.20
-einops
accelerate
-peft
datasets
-transformers_stream_generator
+einops
gguf
+numpy
+peft
+protobuf<3.20
+sentencepiece
tiktoken
+torch==2.1.0+cpu
+transformers
+transforme... | alphabetical order? |
neural-speed | github_2023 | cpp | 113 | intel | airMeng | @@ -438,10 +438,10 @@ class WeightKBlockNInteger {
if (stor->mDType == BTLA_DTYPE::S8 || stor->mDType == BTLA_DTYPE::F8_E4M3 || stor->mDType == BTLA_DTYPE::F8_E5M2) {
reorderWeight(N, K, B, ldb, stor->WPtr<int8_t>(), threading);
} else {
- auto reorded = utils::amalloc<int8_t>((size_t)stor->mKPad ... | I think ```reordered``` might be better because ```reorder``` is a verb |
neural-speed | github_2023 | python | 106 | intel | Zhenzhong1 | @@ -1092,7 +1097,7 @@ def write_file_header(self, params: Params, file_type: NEFileType) -> None:
# but bos_token_id = 1 in llama.cpp
self.fout.write(struct.pack("i", params.bos_token_id))
self.fout.write(struct.pack("i", params.eos_token_id))
- self.fout.write(struct.pack("i", -1))
+ ... | seems also need to modify the bin load function inmodel_file.h. |
neural-speed | github_2023 | python | 100 | intel | zhewang1-intc | @@ -351,66 +398,3 @@ def convert_q4_f32_tensor(src_name, dst_name, model, fout, q_config, n_head, n_h
weight.numpy().tofile(fout)
print(f"converting {dst_name} qauntized tensor to fp32 tensor")
-
-
-def convert_q4_bestla_tensor(src_name, dst_name, model, fout, q_config, n_head, n_head_kv=0, permute_func=Non... | can't this code be reused? |
neural-speed | github_2023 | python | 100 | intel | zhewang1-intc | @@ -0,0 +1,202 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/... | convert `qx` may be a better name cause we can convert int4/int3 weight now. |
neural-speed | github_2023 | python | 100 | intel | airMeng | @@ -175,25 +197,58 @@ def unpack_weight(qweight, scales, qzeros, q_config):
raise ValueError(f"Unsupported q_config without quant_method: {q_config}")
quant_method = q_config["quant_method"]
if quant_method == "gptq":
- return unpack_gptq_weight(qweight, scales, qzeros, q_config)
+ qbit... | make it more explicit
```suggestion
a = torch.tensor([[3 * i for i in range(10)]], dtype=torch.int32)
```
why ```10```, where it comes from? |
neural-speed | github_2023 | python | 100 | intel | airMeng | @@ -0,0 +1,202 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/... | what does ```16``` and ```32``` means? |
neural-speed | github_2023 | python | 100 | intel | airMeng | @@ -213,7 +213,11 @@ def unpack_weight(qweight, scales, qzeros, q_config):
def unpack_gptq_weight_4bits(qweight, scales, qzeros, q_config):
group_size = q_config['group_size']
bits = q_config['bits']
- wf = torch.tensor([[ 0, 4, 8, 12, 16, 20, 24, 28]], dtype=torch.int32)
+ s32_bits = 32
+
+ asser... | since you already defined ```s32_bits``` why not use?
```suggestion
wf = torch.tensor(list(range(0, s32_bits, bits)), dtype=torch.int32).unsqueeze(0)
``` |
neural-speed | github_2023 | python | 100 | intel | zhewang1-intc | @@ -0,0 +1,205 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/... | could we detect whether lm_head.weight need to convert to qx or just keep fp32?
i guess we have the chance, e.g. check whether lm_head.weight have qzeros/scales tensor member.
this may helpful if inc can quantize lm_head to qx in the future. |
neural-speed | github_2023 | python | 100 | intel | zhewang1-intc | @@ -0,0 +1,205 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/... | if q_config['bits']==3, then weight_dtype="int3" |
neural-speed | github_2023 | python | 100 | intel | zhewang1-intc | @@ -27,7 +27,71 @@ def permute_func(weights, n_head: int, n_head_kv: int):
return (weights.reshape(n_head, 2, weights.shape[0] // n_head // 2,
*weights.shape[1:]).swapaxes(1, 2).reshape(weights.shape))
-def main(args_in: Optional[List[str]] = None) -> None:
+def convert_q4_bestla_ten... | as above |
neural-speed | github_2023 | cpp | 71 | intel | airMeng | @@ -49,7 +49,15 @@
#define MODEL_SESSION_MAGIC MODEL_FILE_MAGIC_GGSN
#define MODEL_SESSION_VERSION 1
-int64_t ns_log_level();
+inline int64_t ns_log_level() {
+ static int64_t log_level = -1;
+ if (log_level == -1) { | meaningless?
|
neural-speed | github_2023 | cpp | 71 | intel | DDEle | @@ -399,9 +399,9 @@ static bool llama_model_eval_internal(model_context* ctx, const model_input* inp
ne_build_forward_expand(&gf, inpL);
ne_graph_compute(ctx0, &gf);
- if (ns_log_level() == 0 || ns_log_level() == 2) {
- ne_graph_profiling(&gf);
- }
+ // if (ns_log_level() == 0 || ns_log_level() == 2) {
+ ... | Why no profiling for llama? |
neural-speed | github_2023 | python | 69 | intel | airMeng | @@ -21,6 +21,7 @@
from transformers import AutoConfig, AutoTokenizer
model_maps = {"gpt_neox": "gptneox", "gpt_bigcode": "starcoder"}
+max_request_num_default = 8 | source? |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -54,6 +56,241 @@
namespace py = pybind11;
+namespace {
+struct Query {
+ uint64_t id;
+ std::vector<model_vocab::id> token_ids;
+ Query() {}
+ Query(uint64_t id, const pybind11::array_t<model_vocab::id, py::array::c_style | py::array::forcecast>& token_ids)
+ : id(id), token_ids(token_ids.data(), token... | any specific reasons? |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -54,6 +56,241 @@
namespace py = pybind11;
+namespace {
+struct Query {
+ uint64_t id;
+ std::vector<model_vocab::id> token_ids;
+ Query() {}
+ Query(uint64_t id, const pybind11::array_t<model_vocab::id, py::array::c_style | py::array::forcecast>& token_ids)
+ : id(id), token_ids(token_ids.data(), token... | some comments here might be helpful |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -54,6 +56,241 @@
namespace py = pybind11;
+namespace {
+struct Query {
+ uint64_t id;
+ std::vector<model_vocab::id> token_ids;
+ Query() {}
+ Query(uint64_t id, const pybind11::array_t<model_vocab::id, py::array::c_style | py::array::forcecast>& token_ids)
+ : id(id), token_ids(token_ids.data(), token... | usually we don't encourage so much arguments, you can pack them into several structs instead |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -61,6 +61,8 @@
#define MODEL_SESSION_MAGIC MODEL_FILE_MAGIC_GGSN
#define MODEL_SESSION_VERSION 1
+#define MODEL_MAX_REQUEST_NUM 8 | same as python side? |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -0,0 +1,94 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless req... | why must return a bool instead of void function? |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -0,0 +1,114 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | ```il``` seems confusing |
neural-speed | github_2023 | cpp | 69 | intel | airMeng | @@ -54,6 +56,252 @@
namespace py = pybind11;
+namespace {
+struct Query {
+ uint64_t id;
+ std::vector<model_vocab::id> token_ids;
+ Query() {}
+ Query(uint64_t id, const pybind11::array_t<model_vocab::id, py::array::c_style | py::array::forcecast>& token_ids)
+ : id(id), token_ids(token_ids.data(), token... | why not enum here? |
neural-speed | github_2023 | python | 78 | intel | zhenwei-intel | @@ -35,10 +35,11 @@ def cmpData(numa, numb):
args = parser.parse_args()
woq_configs = {
- "fp32": {"not_quant":True},
- # "ggml_int4": {"compute_dtype":"int8", "weight_dtype":"int4", "use_ggml":True},
- "jblas_int4": {"compute_dtype":"int8", "weight_dtype":"int4"},
- # "jblas_int... | use_cache is removed |
neural-speed | github_2023 | others | 78 | intel | zhenwei-intel | @@ -13,4 +13,5 @@ tiktoken
py-cpuinfo
gguf
cmake
+auto-gptq | why need gptq? which can only run on GPU |
neural-speed | github_2023 | python | 78 | intel | Zhenzhong1 | @@ -0,0 +1,307 @@
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by... | please check model_file.h:L942
tokenizer.bos_token_id and other special ids should be uint32. -1 should not be the default. |
neural-speed | github_2023 | python | 78 | intel | Zhenzhong1 | @@ -0,0 +1,307 @@
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by... | If you decide to use GGUF as the convert format, you don't need to add these useless parameters. Please remove these unused parameters and try again.
such as clip_qkv, par_res... |
neural-speed | github_2023 | cpp | 79 | intel | airMeng | @@ -424,9 +419,6 @@ void sdp_fwd_run(uint32_t iter) {
uint32_t boundary_n = (start_n + wg_tile_n_sv) > matrix_n
? matrix_n
: (start_n + wg_tile_n_sv);
- uint32_t boundary_m = (start_m + wg_tile_m_sv) > matrix_m
- ... | no boundary_m needed? |
neural-speed | github_2023 | cpp | 79 | intel | airMeng | @@ -102,8 +102,7 @@ struct xetla_nbarrier_t<num_producers, num_consumers, gpu_arch::Dg2> {
/// note: all subgroups participating the barrier should have the same
/// barrier_id. Here is the bspec link
/// https://gfxspecs.intel.com/Predator/Home/Index/54006
- __XETLA_API void init_nbarrier(uint8_t nb... | confirmed? |
neural-speed | github_2023 | python | 20 | intel | airMeng | @@ -94,6 +94,10 @@ def init(self, model_name, not_quant=False, use_cache=False,
quant_desc += "_pc"
else:
quant_desc += "_g{}".format(group_size)
+ if use_gptq:
+ quant_desc = "gptq"
+ if use_awq:
+ quant_desc = "awq" | why not?
```suggestion
if use_gptq:
quant_desc += "_gptq"
if use_awq:
quant_desc += "_awq"
``` |
neural-speed | github_2023 | cpp | 43 | intel | airMeng | @@ -303,10 +303,20 @@ class CpuDevice {
for (auto& i : SMT_core) printf("%d,", i);
printf("\n");
}
- E_L1Cache = L1[E_core[0]];
- E_L2Cache = L2[E_core[0]] / 4;
- L1Cache = E_L1Cache > L1[P_core[0]] / 2 ? L1[P_core[0]] / 2 : E_L1Cache;
- L2Cache = E_L2Cache > L... | clang-tidy [readability-container-size-empty]
```suggestion
if (!E_core.empty() && !P_core.empty()) {
```
same for line311 |
neural-speed | github_2023 | cpp | 43 | intel | airMeng | @@ -303,10 +303,20 @@ class CpuDevice {
for (auto& i : SMT_core) printf("%d,", i);
printf("\n");
}
- E_L1Cache = L1[E_core[0]];
- E_L2Cache = L2[E_core[0]] / 4;
- L1Cache = E_L1Cache > L1[P_core[0]] / 2 ? L1[P_core[0]] / 2 : E_L1Cache;
- L2Cache = E_L2Cache > L... | p_core only == SMT ON? |
neural-speed | github_2023 | cpp | 43 | intel | airMeng | @@ -303,10 +303,22 @@ class CpuDevice {
for (auto& i : SMT_core) printf("%d,", i);
printf("\n");
}
- E_L1Cache = L1[E_core[0]];
- E_L2Cache = L2[E_core[0]] / 4;
- L1Cache = E_L1Cache > L1[P_core[0]] / 2 ? L1[P_core[0]] / 2 : E_L1Cache;
- L2Cache = E_L2Cache > L... | L1 is uint32, can you divide it directly? |
neural-speed | github_2023 | cpp | 46 | intel | DDEle | @@ -73,7 +73,8 @@ class Model {
// deprecated API
std::vector<std::vector<model_token>> generate_tokens(const std::vector<std::vector<model_token>>& input_ids);
const std::vector<float>& evaluate_(const std::vector<std::vector<model_token>>& input_ids);
- py::array_t<float> evaluate(const std::vector<std::vec... | Otherwise, it seems to be an unexpected behavior if called `evaluate` with `logits_all = true` and then `logits_all = false`
```suggestion
ctx->logits_all = logits_all;
``` |
neural-speed | github_2023 | cpp | 48 | intel | zhenwei-intel | @@ -112,41 +113,78 @@ void Llama::load(model_context* ctx, model_progress_callback progress_callback,
ml->ne_ctx = ne_ctx;
- model.others[0] = ml->get_tensor("tok_embeddings.weight", {n_embd, n_vocab}, NE_BACKEND_CPU);
- model.others[1] = ml->get_tensor("norm.weight", {n_embd}, NE_BACKEND_CPU);
- model.others... | why different tensor name here? |
neural-speed | github_2023 | python | 48 | intel | zhenwei-intel | @@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2023 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/l... | ```suggestion
# -m /path/to/ggml-model-f32.gguf
``` |
neural-speed | github_2023 | others | 48 | intel | a32543254 | @@ -473,3 +473,85 @@ Available modes:
- 0: Print all tracing information. Comprehensive output, including: evaluation time and operator profiling.
- 1: Print evaluation time. Time taken for each evaluation.
- 2: Profile individual operator. Identify performance bottleneck within the model.
+
+### 7. GGUF
+
+Currentl... | no put GGUF from hf or from llama.cpp in here. |
neural-speed | github_2023 | others | 48 | intel | a32543254 | @@ -473,3 +473,85 @@ Available modes:
- 0: Print all tracing information. Comprehensive output, including: evaluation time and operator profiling.
- 1: Print evaluation time. Time taken for each evaluation.
- 2: Profile individual operator. Identify performance bottleneck within the model.
+
+### 7. GGUF
+
+Currentl... | choose llama or mistral |
neural-speed | github_2023 | python | 48 | intel | a32543254 | @@ -155,38 +152,44 @@ def chatglm2_convert_gguf(model, tokenizer, dir_model, fname_out, ftype, hparams
print(name, list_vars[name].shape, list_vars[name].dtype)
print(hparams)
- fout = open(fname_out, "wb")
gguf_file = fname_out + '.gguf'
gguf_writer = gguf.GGUFWriter(gguf_file, "chatglm2... | we cannot set bos and eos as 0 as default, beacuse some time the 0 token id mean some word |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -102,6 +102,8 @@ bool isValidFilename(const std::string& filename) {
return infile.good();
}
+int64_t common_time_us() { return ne_time_us(); } | why not using ```ne_time_us``` directly? |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -0,0 +1,74 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless req... | /no new line |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -0,0 +1,653 @@
+// Copyright (c) 2023 Intel Corporation | good to decouple as much as possible 👍 |
neural-speed | github_2023 | python | 45 | intel | airMeng | @@ -26,6 +26,7 @@ def main(args_in: Optional[List[str]] = None) -> None:
default="f32",
)
parser.add_argument("--outfile", type=Path, required=True, help="path to write to")
+ parser.add_argument("--whisper_repo_path", type=Path, required=False, help="path to whisper repo") | what kinds of path, can you clarify on readme? |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -0,0 +1,55 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless req... | check whether these are useful in this file |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -2434,9 +2433,9 @@ void whisper_free(struct whisper_context* ctx) {
if (ctx->model.ctx) {
ne_free(ctx->model.ctx);
}
- if (ctx->model.buf) {
- delete ctx->model.buf;
- }
+ // if (ctx->model.buf) {
+ // delete ctx->model.buf;
+ // } | why not delete? |
neural-speed | github_2023 | python | 45 | intel | airMeng | @@ -88,138 +91,148 @@ def bytes_to_unicode():
return dict(zip(bs, cs))
-if len(sys.argv) < 4:
- print("Usage: convert-h5-to-ggml.py dir_model path-to-whisper-repo dir-output [use-f32]\n")
- sys.exit(1)
-
-dir_model = Path(sys.argv[1])
-dir_whisper = Path(sys.argv[2])
-dir_out = Path(sys.argv[3])
-
-encod... | no new line
you can set it in vscode settings |
neural-speed | github_2023 | cpp | 45 | intel | airMeng | @@ -0,0 +1,472 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | / no new line |
neural-speed | github_2023 | others | 60 | intel | airMeng | @@ -13,3 +13,5 @@ build/
debug/
.eggs/
dist/
+.cache/
+.clangd | no new line |
neural-speed | github_2023 | cpp | 60 | intel | airMeng | @@ -40,7 +40,7 @@ static int8_t cache[CacheSize];
#define FP16_ERR 0.001f
#define BF16_ERR 0.02f
#define INT8_ERR 0.2f
-#define F8_ERR 1.4f
+#define F8_ERR 1.5f | source? |
neural-speed | github_2023 | cpp | 19 | intel | luoyu-intel | @@ -161,15 +161,14 @@ BTLA_CODE dequant_kblock_s8_fp_fwd(int8_t* srcptr, _DST_T* dstptr, int row, int
auto s8_ymm_v = _mm_loadl_epi64(reinterpret_cast<__m128i*>(srcptr + i * ld_src + j));
auto s32_ymm_v = _mm256_cvtepi8_epi32(s8_ymm_v);
if constexpr (WITH_ZP) {
- s32_ymm_v = _mm256_sub_epi32... | how about PACK_ROW==2? |
neural-speed | github_2023 | cpp | 59 | intel | airMeng | @@ -125,7 +126,34 @@ class WeightKBlockNInteger {
return tmp;
}
+ void doubleQuantScale(float* scale, size_t scale_size, int dq_blocksize, BTLA_DTYPE qtype,
+ utils::aligned_vector<float>* dq_buf) {
+ if (qtype == BTLA_DTYPE::DQ8_BNB) {
+ dq_buf->resize(utils::updiv(scale_size,... | No kernel wrapper here? |
neural-speed | github_2023 | cpp | 59 | intel | airMeng | @@ -731,6 +795,22 @@ class WeightKBlockNInteger {
} else {
assert(0);
}
+ } else if (wptr->SDtype() == BTLA_DTYPE::DQ8_BNB) {
+ auto internal_n_offset = n_offset + i;
+ if (wptr->mDType == BTLA_DTYPE::S4_CLIP) {
+ kernel::wrapper::DecompressDQKBlockS4Fp<_T, _Gemm... | shall we decouple scales and weight here?
instead of w_s4_scale_s8 => s_fp in one function,
w_s4_scale_s8 => w_s4_scale_fp => w_fp with 2 functions? |
neural-speed | github_2023 | cpp | 59 | intel | airMeng | @@ -222,6 +222,43 @@ class Memcpy2DBf16CvtFp32 {
}
};
+template <typename _DST_T, int _PACK_ROW>
+class DecompressDQKBlockS4Fp {
+ public:
+ template <BTLA_ISA ISA_T, BTLA_DTYPE S4_T>
+ static inline BTLA_CODE forward(utils::int4x2* srcptr, _DST_T* dstptr, int row, int col, int ld_src, int ld_dst,
+ ... | only reference function needed? |
neural-speed | github_2023 | others | 37 | intel | kevinintel | @@ -10,6 +10,63 @@ Neural Speed is an innovation library designed to provide the efficient inferenc
> Neural Speed is under active development so APIs are subject to change.
+## Quick Start
+There are two methods for utilizing the Neural Speed:
+- [Transformer-based API](#How-to-use-Transformer-based-API) | link back to ITREX and remove "How to use: Transformer-based API" in NeuralSpeed |
neural-speed | github_2023 | others | 37 | intel | kevinintel | @@ -346,7 +366,7 @@ Our Neural Speed supports INT4 / INT8 / FP8 (E4M3, E5M2) / FP4 (E2M1) / NF4 wei
| NF4 | BF16 / FP16 / FP32 (FP32) | BF16 / FP32 (FP32) | sym (sym) |
-### 2. Inference LLM
+### 2. Inference
We provide LLM inference script to run the quantized model. Please reach [us](mailto:itrex.maintainers... | add enabling new models from https://github.com/intel/intel-extension-for-transformers/blob/main/intel_extension_for_transformers/llm/runtime/graph/developer_document.md
|
neural-speed | github_2023 | others | 37 | intel | luoyu-intel | @@ -10,6 +10,39 @@ Neural Speed is an innovation library designed to provide the efficient inferenc
> Neural Speed is under active development so APIs are subject to change.
+## Quick Start
+There are two methods for utilizing the Neural Speed:
+You can refer to [ITREX(intel extension for transformers)](https://gi... | as it's a python call, can it be done on Windows without numactl? |
neural-speed | github_2023 | others | 37 | intel | a32543254 | @@ -10,6 +10,38 @@ Neural Speed is an innovation library designed to provide the efficient inferenc
> Neural Speed is under active development so APIs are subject to change.
+## Quick Start
+There are two methods for utilizing the Neural Speed:
+You can refer to [ITREX(intel extension for transformers)](https://gi... | we only compatible for GGUF format from llama cpp |
neural-speed | github_2023 | others | 37 | intel | a32543254 | @@ -10,6 +10,38 @@ Neural Speed is an innovation library designed to provide the efficient inferenc
> Neural Speed is under active development so APIs are subject to change.
+## Quick Start
+There are two methods for utilizing the Neural Speed:
+You can refer to [ITREX(intel extension for transformers)](https://gi... | do we have neural speed maintainer email ? |
neural-speed | github_2023 | others | 37 | intel | zhenwei-intel | @@ -10,6 +10,44 @@ Neural Speed is an innovation library designed to provide the efficient inferenc
> Neural Speed is under active development so APIs are subject to change.
+You can refer [this blog](https://medium.com/@NeuralCompressor/llm-performance-of-intel-extension-for-transformers-f7d061556176) to get the ... | we can also use neural speed python api:
```python
from transformers import AutoTokenizer, TextStreamer
from neural_speed import Model
prompt = "Once upon a time, a little girl"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
inputs = tokenizer(prompt, return_tensors="pt").input_id... |
neural-speed | github_2023 | python | 50 | intel | zhentaoyu | @@ -189,7 +188,7 @@ def generate(self, input_ids, streamer=None, interactive=False, ignore_prompt=Fa
if stopping_criteria is not None:
if stopping_criteria(torch.tensor(ret), None):
break
- elif ret[0][-1] == self.tokenizer.eos_token_id or \
+ eli... | why change it? Should they be the same? Or do you want to remove the `tokenizer` dependency? |
neural-speed | github_2023 | python | 41 | intel | zhenwei-intel | @@ -178,6 +181,11 @@ def loadHFTransformerJson(model: 'LazyModel', config_path: Path) -> 'Params':
ffn_hidden_size = config["intermediate_size"]
rms_norm_eps = config["rms_norm_eps"]
rope_theta = config["rope_theta"] if "rope_theta" in config else 10000
+ rope_scale = 1
+ if con... | please check whether "rope_scaling" in config
```suggestion
if "rope_scaling" in config and config["rope_scaling"] is not None:
``` |
neural-speed | github_2023 | python | 41 | intel | zhenwei-intel | @@ -179,6 +180,8 @@ def loadHFTransformerJson(model: 'LazyModel', config_path: Path) -> 'Params':
ffn_hidden_size = config["intermediate_size"]
rms_norm_eps = config["rms_norm_eps"]
rope_theta = config["rope_theta"] if "rope_theta" in config else 10000
+ rope_scale = config["factor"] i... | mistral should align to llama |
neural-speed | github_2023 | others | 41 | intel | VincyZhang | @@ -247,7 +247,7 @@ function main() {
infer_cmd="./build/bin/run_qwen"
elif [[ "${model}" == "magicoder" ]]; then
quant_script="./build/bin/quant_llama"
- convert_script="${convert_script}/convert_bmagicoder.py"
+ convert_script="${convert_script}/convert_llama.py" | why use llama? |
neural-speed | github_2023 | python | 49 | intel | a32543254 | @@ -73,67 +73,70 @@ def get_model_type(model_config):
model_type = "chatglm2"
return model_type
- def init(self, model_name, not_quant=False, use_cache=False, use_gptq=False, use_awq=False,
- weight_dtype="int4", alg="sym", group_size=32,
- scale_dtype="fp32", compute_dt... | why remove the default value of init args ? |
neural-speed | github_2023 | python | 49 | intel | a32543254 | @@ -73,67 +73,70 @@ def get_model_type(model_config):
model_type = "chatglm2"
return model_type
- def init(self, model_name, not_quant=False, use_cache=False, use_gptq=False, use_awq=False,
- weight_dtype="int4", alg="sym", group_size=32,
- scale_dtype="fp32", compute_dt... | keep awq |
neural-speed | github_2023 | others | 42 | intel | airMeng | @@ -0,0 +1,188 @@
+#!/bin/bash
+set -eo pipefail
+set -x
+
+# IMPORTANT! we use half of one socket cores to simulate TP functionality
+cores_list=(24)
+# model_list=("llama2-7b" "llama2-13b" "llama2-70b" "gptj-6b" "baichuan-13b")
+model_list=("llama2-7b")
+input_list=(32 1024 2016)
+output=32
+beam_list=(1)
+precision_... | shall we check whether ccl has been installed to save time? for example, do we recommend to install oneCCL via oneAPI? |
neural-speed | github_2023 | others | 42 | intel | airMeng | @@ -0,0 +1,188 @@
+#!/bin/bash
+set -eo pipefail
+set -x
+
+# IMPORTANT! we use half of one socket cores to simulate TP functionality
+cores_list=(24)
+# model_list=("llama2-7b" "llama2-13b" "llama2-70b" "gptj-6b" "baichuan-13b")
+model_list=("llama2-7b")
+input_list=(32 1024 2016)
+output=32
+beam_list=(1)
+precision_... | align to https://github.com/intel/neural-speed/pull/28/files |
neural-speed | github_2023 | cpp | 42 | intel | luoyu-intel | @@ -442,6 +442,15 @@ int main(int argc, char** argv) { // NOLINT
model_reset_timings(ctx);
}
+#ifdef NE_TP_MODEL | NE should be replaced by NS in this repo |
neural-speed | github_2023 | cpp | 42 | intel | luoyu-intel | @@ -0,0 +1,136 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | Is this file prevented from being used on Windows? |
neural-speed | github_2023 | cpp | 42 | intel | airMeng | @@ -0,0 +1,136 @@
+// Copyright (c) 2023 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless re... | if just number, ```const static``` might to more explicit for readers |
neural-speed | github_2023 | cpp | 7 | intel | DDEle | @@ -405,6 +405,43 @@ int main(int argc, char** argv) { // NOLINT
const bool penalize_nl = params.penalize_nl;
model_token id = 0;
+ if (params.warmup) {
+ {
+ const std::vector<model_token> tmp(32, ctx->vocab.bos_token_id);
+ std::vector<model_input> inputs = {model_input{
+ /*.tokens ... | Will it affect overall performance as warmup are added by default?
In addition, it causes invalid `n_past` if `-n` not set as command line arguments.
cc @zhenwei-intel |
neural-speed | github_2023 | others | 29 | intel | DDEle | @@ -2,12 +2,19 @@
source /neural-speed/.github/workflows/scripts/change_color.sh
-pip install cpplint
+pip install cmake ninja clang-tidy | Should we use 14 to match the clang-format we are using? |
neural-speed | github_2023 | cpp | 29 | intel | luoyu-intel | @@ -13,7 +13,15 @@
// limitations under the License.
#pragma once
#include <type_traits>
-#ifdef _OPENMP
+
+#ifdef CLANGTIDY
+#define NO_CLANGTIDY false
+#else
+#define NO_CLANGTIDY true
+#endif
+
+#define BTLA_OPENMP ((_OPENMP) && (NO_CLANGTIDY)) | Why are codes aware of CLANGTIDY? not reasonable. What if we change clang-tidy to other tools? |
neural-speed | github_2023 | cpp | 29 | intel | luoyu-intel | @@ -2434,21 +2434,14 @@ void whisper_free(struct whisper_context* ctx) {
if (ctx->model.ctx) {
ne_free(ctx->model.ctx);
}
- if (ctx->model.buf) {
- delete ctx->model.buf;
- }
+ delete ctx->model.buf; | why remove the condition? how about using std-way to manage buffer? |
neural-speed | github_2023 | others | 29 | intel | luoyu-intel | @@ -46,7 +43,12 @@ endif()
include(GNUInstallDirs)
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
-
+
+if(BTLA_USE_OPENMP)
+message(STATUS "BesTLA using OpenMP")
+target_compile_definitions(${PROJECT_NAME} INTERFACE BTLA_USE_OPENMP) | As we split parallelism from the bestla library, what does BTLA_USE_OPENMP mean? OMPThreading is created for easy use of UTs. It can be moved to bestla_ut.h file. |
neural-speed | github_2023 | others | 38 | intel | kevinintel | @@ -0,0 +1,200 @@
+ Apache License
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as de... | Copyright |
neural-speed | github_2023 | others | 15 | intel | ftian1 | @@ -0,0 +1,246 @@
+# Proposal of sub-byte low precision inference for PyTorch/IPEX
+
+**Authors:**
+* @xinhe3, hengyume
+
+## **Summary**
+In this proposal, we mainly discuss the storage data type, compute data type, quantization, and serialization, to facilitate the low-bit (INT4/FP4) LLM inference for PyTorch/IPEX.
+... | the first input of woqlinear should be fp32 but not uint4. uint4 should be only used in weight part.
the remaining codes have same issues |
neural-speed | github_2023 | cpp | 11 | intel | airMeng | @@ -353,9 +359,9 @@ class gemm_t<
xetla_nbarrier_t<wg_size_x, wg_size_x, arch_tag> nbarrier_a;
nbarrier_a.init_nbarrier(
sg_idy + nbarrier_base, nbarrier_role::producer_consumer);
- xetla_nbarrier_t<wg_size_y, wg_size_y, arch_tag> nbarrier_b;
- nbarrier_b.init_nbarrier(s... | shall there be nbarrier? |
neural-speed | github_2023 | cpp | 11 | intel | airMeng | @@ -366,10 +372,12 @@ class gemm_t<
matA_prefetch_payload);
subgroup::tile_prefetch<cache_hint::cached, cache_hint::cached>(
matB_prefetch_payload);
- subgroup::tile_prefetch<cache_hint::cached, cache_hint::cached>(
- scale_prefetch_pa... | add TODO here |
neural-speed | github_2023 | cpp | 11 | intel | airMeng | @@ -206,27 +206,28 @@ void dequantize_gemm_run(int iter) {
static constexpr uint32_t prefetch_distance = 3;
using mem_desc_a_t = xetla::mem_desc_t<data_type_a, mem_layout::row_major,
- mem_space::global>;
+ mem_space::global, DEVICE_MEM_ALIGNMENT / sizeof(data_type_a)>;
using mem_... | pass gpu_arch as template parameters and determine through SIMD width during runtime to maintain PVC capability |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.