Move is_iq() into a lambda and remove unused variables
This commit is contained in:
parent
8eedcf74bc
commit
a74b410f5f
|
|
@ -727,11 +727,28 @@ static std::unordered_map<std::string, ggml_type> target_bpw_type(
|
||||||
return (double)bytes * 8.0 / (double)ggml_nelements(t);
|
return (double)bytes * 8.0 / (double)ggml_nelements(t);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto is_compatible = [&](const ggml_tensor * t, const ggml_type typ) -> bool {
|
auto is_compatible = [](const ggml_tensor * t, const ggml_type typ) -> bool {
|
||||||
const int64_t blck = ggml_blck_size(typ);
|
const int64_t blck = ggml_blck_size(typ);
|
||||||
return blck <= 1 || (t->ne[0] % blck) == 0;
|
return blck <= 1 || (t->ne[0] % blck) == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto is_iq = [](const enum ggml_type t) {
|
||||||
|
switch (t) {
|
||||||
|
case GGML_TYPE_IQ1_S:
|
||||||
|
case GGML_TYPE_IQ1_M:
|
||||||
|
case GGML_TYPE_IQ2_XXS:
|
||||||
|
case GGML_TYPE_IQ2_XS:
|
||||||
|
case GGML_TYPE_IQ2_S:
|
||||||
|
case GGML_TYPE_IQ3_XXS:
|
||||||
|
case GGML_TYPE_IQ3_S:
|
||||||
|
case GGML_TYPE_IQ4_NL:
|
||||||
|
case GGML_TYPE_IQ4_XS:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto make_compatible = [&](const ggml_tensor * t, const ggml_type typ) -> ggml_type {
|
auto make_compatible = [&](const ggml_tensor * t, const ggml_type typ) -> ggml_type {
|
||||||
if (is_compatible(t, typ)) return typ;
|
if (is_compatible(t, typ)) return typ;
|
||||||
ggml_type fb = fallback_type(typ);
|
ggml_type fb = fallback_type(typ);
|
||||||
|
|
@ -995,8 +1012,6 @@ static std::unordered_map<std::string, ggml_type> target_bpw_type(
|
||||||
std::vector<tensor_info> all;
|
std::vector<tensor_info> all;
|
||||||
all.reserve(tensors.size());
|
all.reserve(tensors.size());
|
||||||
for (const auto * tw : tensors) {
|
for (const auto * tw : tensors) {
|
||||||
std::vector<std::thread> workers;
|
|
||||||
workers.reserve(std::max(1, nthread));
|
|
||||||
ggml_tensor * tensor = tw->tensor;
|
ggml_tensor * tensor = tw->tensor;
|
||||||
const std::string name = ggml_get_name(tensor);
|
const std::string name = ggml_get_name(tensor);
|
||||||
if (!can_quantize(tensor)) { continue; }
|
if (!can_quantize(tensor)) { continue; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue