From 3b6075ceac45919f6ed3747976d205dd5771abc2 Mon Sep 17 00:00:00 2001 From: co63oc Date: Thu, 8 May 2025 09:16:37 +0800 Subject: [PATCH] Fix typos in multiple files Signed-off-by: co63oc --- common/chat.cpp | 4 ++-- common/common.h | 4 ++-- common/stb_image.h | 14 +++++++------- convert_hf_to_gguf.py | 6 +++--- ggml/src/ggml-cann/acl_tensor.cpp | 2 +- ggml/src/ggml-cann/aclnn_ops.cpp | 4 ++-- ggml/src/ggml-cpu/llamafile/sgemm.cpp | 2 +- ggml/src/ggml-kompute/ggml-kompute.cpp | 2 +- ggml/src/ggml-sycl/common.hpp | 8 ++++---- ggml/src/ggml-sycl/ggml-sycl.cpp | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/common/chat.cpp b/common/chat.cpp index bbc5f087cdcc0..e31e7abb137f0 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -9,7 +9,7 @@ typedef minja::chat_template common_chat_template; struct common_chat_templates { - bool has_explicit_template; // Model had builtin template or template overridde was specified. + bool has_explicit_template; // Model had builtin template or template overridden was specified. std::unique_ptr template_default; // always set (defaults to chatml) std::unique_ptr template_tool_use; }; @@ -644,7 +644,7 @@ static std::string apply( // tmpl_inputs.now = std::chrono::system_clock::now(); minja::chat_template_options tmpl_opts; - // To avoid double BOS / EOS tokens, we're manually removing begining / trailing tokens + // To avoid double BOS / EOS tokens, we're manually removing beginning / trailing tokens // instead of using `chat_template_options.use_bos_token = false`, since these tokens // may be needed inside the template / between messages too. auto result = tmpl.apply(tmpl_inputs, tmpl_opts); diff --git a/common/common.h b/common/common.h index 400f674b2283d..33bf677458f57 100644 --- a/common/common.h +++ b/common/common.h @@ -321,7 +321,7 @@ struct common_params { bool cont_batching = true; // insert new sequences for decoding on-the-fly bool flash_attn = false; // flash attention bool no_perf = false; // disable performance metrics - bool ctx_shift = true; // context shift on inifinite text generation + bool ctx_shift = true; // context shift on infinite text generation bool input_prefix_bos = false; // prefix BOS to user inputs, preceding input_prefix bool logits_all = false; // return logits for all tokens in the batch @@ -628,7 +628,7 @@ void common_kv_cache_dump_view_seqs(const llama_kv_cache_view & view, int row_si // Embedding utils // -// TODO: repace embd_norm with an enum +// TODO: replace embd_norm with an enum void common_embd_normalize(const float * inp, float * out, int n, int embd_norm); float common_embd_similarity_cos(const float * embd1, const float * embd2, int n); diff --git a/common/stb_image.h b/common/stb_image.h index 9eedabedc45b3..c813f337f7148 100644 --- a/common/stb_image.h +++ b/common/stb_image.h @@ -2155,7 +2155,7 @@ stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n) unsigned int k; int sgn; if (j->code_bits < n) stbi__grow_buffer_unsafe(j); - if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing + if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s instead of continuing sgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 if MSB set (negative) k = stbi_lrot(j->code_buffer, n); @@ -2170,7 +2170,7 @@ stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) { unsigned int k; if (j->code_bits < n) stbi__grow_buffer_unsafe(j); - if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing + if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s instead of continuing k = stbi_lrot(j->code_buffer, n); j->code_buffer = k & ~stbi__bmask[n]; k &= stbi__bmask[n]; @@ -2182,7 +2182,7 @@ stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) { unsigned int k; if (j->code_bits < 1) stbi__grow_buffer_unsafe(j); - if (j->code_bits < 1) return 0; // ran out of bits from stream, return 0s intead of continuing + if (j->code_bits < 1) return 0; // ran out of bits from stream, return 0s instead of continuing k = j->code_buffer; j->code_buffer <<= 1; --j->code_bits; @@ -4961,7 +4961,7 @@ static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0); if (p == NULL) return stbi__err("outofmem", "Out of memory"); - // between here and free(out) below, exitting would leak + // between here and free(out) below, exiting would leak temp_out = p; if (pal_img_n == 3) { @@ -5901,7 +5901,7 @@ static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req if (tga_height > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); if (tga_width > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - // do a tiny bit of precessing + // do a tiny bit of processing if ( tga_image_type >= 8 ) { tga_image_type -= 8; @@ -6832,7 +6832,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i // 0: not specified. } - // background is what out is after the undoing of the previou frame; + // background is what out is after the undoing of the previous frame; memcpy( g->background, g->out, 4 * g->w * g->h ); } @@ -7865,7 +7865,7 @@ STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user 1.31 (2011-06-20) a few more leak fixes, bug in PNG handling (SpartanJ) 1.30 (2011-06-11) - added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) + added ability to load files via callbacks to accommodate custom input streams (Ben Wenger) removed deprecated format-specific test/load functions removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index a6aaf883464b2..6cb48fa9ab406 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -2664,7 +2664,7 @@ def set_gguf_parameters(self): self.gguf_writer.add_vision_n_wa_pattern(n_wa_pattern) else: raise ValueError(f"Unknown QwenVL model type: {self.global_config['model_type']}") - # default values below are taken from HF tranformers code + # default values below are taken from HF transformers code self.gguf_writer.add_vision_attention_layernorm_eps(self.global_config.get("rms_norm_eps", 1e-6)) def tensor_force_quant(self, name, new_name, bid, n_dims): @@ -2699,7 +2699,7 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter # split Conv3D into Conv2Ds c1, c2, kt, kh, kw = data_torch.shape del c1, c2, kh, kw # unused - assert kt == 2, "Current implmentation only support temporal_patch_size of 2" + assert kt == 2, "Current implementation only support temporal_patch_size of 2" return [ (gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_ENC_EMBD_PATCH] + ".weight" , data_torch[:, :, 0, ...]), (gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_ENC_EMBD_PATCH] + ".weight.1", data_torch[:, :, 1, ...]), @@ -3912,7 +3912,7 @@ def set_gguf_parameters(self): super().set_gguf_parameters() hparams = self.hparams self.gguf_writer.add_vision_projector_type(gguf.VisionProjectorType.GEMMA3) - # default values below are taken from HF tranformers code + # default values below are taken from HF transformers code self.gguf_writer.add_vision_attention_layernorm_eps(hparams.get("layer_norm_eps", 1e-6)) self.gguf_writer.add_vision_use_gelu(True) # calculate proj_scale_factor (used by tinygemma3 test model) diff --git a/ggml/src/ggml-cann/acl_tensor.cpp b/ggml/src/ggml-cann/acl_tensor.cpp index f5462c5a18e37..e52ea291d3e56 100644 --- a/ggml/src/ggml-cann/acl_tensor.cpp +++ b/ggml/src/ggml-cann/acl_tensor.cpp @@ -130,7 +130,7 @@ int64_t ggml_cann_get_mulmat_bcast_shape( const size_t* input_nb, const size_t* weight_nb, const size_t* dst_nb, int64_t* bcast_input_ne, int64_t* bcast_weight_ne, int64_t* bcast_dst_ne, size_t* bcast_input_nb, size_t* bcast_weight_nb, size_t* bcast_dst_nb) { - // input and dst shoule in same shape, except first two dims. + // input and dst should in same shape, except first two dims. GGML_ASSERT(input_ne[2] == dst_ne[2]); GGML_ASSERT(input_ne[3] == dst_ne[3]); diff --git a/ggml/src/ggml-cann/aclnn_ops.cpp b/ggml/src/ggml-cann/aclnn_ops.cpp index 67c0223c010a1..810c6b0a2edb4 100644 --- a/ggml/src/ggml-cann/aclnn_ops.cpp +++ b/ggml/src/ggml-cann/aclnn_ops.cpp @@ -541,7 +541,7 @@ void ggml_cann_pad(ggml_backend_cann_context& ctx, ggml_tensor* dst) { aclTensor* acl_dst = ggml_cann_create_tensor(dst); // padding: value in the array means how much distance will be padding. - // the position of elements in the array means which dirction to padding, + // the position of elements in the array means which direction to padding, // each position means: [dim0.front, dim0.behind, dim1.front, dim1.behind, // dim2.front, dim2.behind, dim3.front, dim3.behind] int64_t paddings[] = { @@ -863,7 +863,7 @@ void ggml_cann_rms_norm(ggml_backend_cann_context& ctx, ggml_tensor* dst) { ggml_cann_release_resources(ctx, acl_src, acl_dst, acl_gamma, acl_rstd); } -// TODO: performace is low. +// TODO: performance is low. void ggml_cann_diag_mask(ggml_backend_cann_context& ctx, ggml_tensor* dst, float value) { ggml_tensor* src = dst->src[0]; diff --git a/ggml/src/ggml-cpu/llamafile/sgemm.cpp b/ggml/src/ggml-cpu/llamafile/sgemm.cpp index 1d46158f928c4..81bcb84cdc7ba 100644 --- a/ggml/src/ggml-cpu/llamafile/sgemm.cpp +++ b/ggml/src/ggml-cpu/llamafile/sgemm.cpp @@ -353,7 +353,7 @@ class tinyBLAS { if constexpr (RN > 1) { return mnpack(m, n, SIZE_N, BN); } else { - GGML_LOG_ERROR("mnpack<%d, %d> bloc size not supported\n", RM, (int)SIZE_N); + GGML_LOG_ERROR("mnpack<%d, %d> block size not supported\n", RM, (int)SIZE_N); GGML_ASSERT(false); // we have miss something. } } diff --git a/ggml/src/ggml-kompute/ggml-kompute.cpp b/ggml/src/ggml-kompute/ggml-kompute.cpp index 50579227183d3..7e6b9c1e10c19 100644 --- a/ggml/src/ggml-kompute/ggml-kompute.cpp +++ b/ggml/src/ggml-kompute/ggml-kompute.cpp @@ -1698,7 +1698,7 @@ static void ggml_vk_graph_compute(struct ggml_kompute_context * ctx, struct ggml if (ggml_is_transposed(src0) || ggml_is_transposed(src1)) { - fprintf(stderr, "%s: %s: matmul on tranposed tensor not supported: %u/%u\n", __func__, ggml_op_name(dst->op), src0t, src1t); + fprintf(stderr, "%s: %s: matmul on transposed tensor not supported: %u/%u\n", __func__, ggml_op_name(dst->op), src0t, src1t); goto not_implemented; } diff --git a/ggml/src/ggml-sycl/common.hpp b/ggml/src/ggml-sycl/common.hpp index c71cc89c09eac..722320f360508 100644 --- a/ggml/src/ggml-sycl/common.hpp +++ b/ggml/src/ggml-sycl/common.hpp @@ -64,10 +64,10 @@ extern int g_ggml_sycl_disable_optimize; #define __SYCL_ARCH__ DPCT_COMPATIBILITY_TEMP -#define VER_4VEC 610 // todo for hardward optimize. -#define VER_GEN9 700 // todo for hardward optimize. -#define VER_GEN12 1000000 // todo for hardward optimize. -#define VER_GEN13 (VER_GEN12 + 1030) // todo for hardward optimize. +#define VER_4VEC 610 // todo for hardware optimize. +#define VER_GEN9 700 // todo for hardware optimize. +#define VER_GEN12 1000000 // todo for hardware optimize. +#define VER_GEN13 (VER_GEN12 + 1030) // todo for hardware optimize. #define GGML_SYCL_MAX_NODES 8192 // TODO: adapt to hardwares diff --git a/ggml/src/ggml-sycl/ggml-sycl.cpp b/ggml/src/ggml-sycl/ggml-sycl.cpp index ea5d10f40ee38..cf086f4dc6497 100644 --- a/ggml/src/ggml-sycl/ggml-sycl.cpp +++ b/ggml/src/ggml-sycl/ggml-sycl.cpp @@ -1246,7 +1246,7 @@ struct ggml_sycl_pool_host : public ggml_sycl_pool { size_t size = 0; }; - // Set arbitrarly to 64 + // Set arbitrarily to 64 static constexpr int MAX_POOL_SIZE{ 64 }; std::vector buffer_pool = std::vector(MAX_POOL_SIZE); size_t pool_size = 0;