Repository Analysis

ggml-org/whisper.cpp

Port of OpenAI's Whisper model in C/C++

2.2 Likely human-written View on GitHub
2.2
Adjusted Score
2.2
Raw Score
100%
Time Factor
2026-05-29
Last Push
50,259
Stars
C++
Language
448,072
Lines of Code
1010
Files
953
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 1HIGH 3MEDIUM 32LOW 917

Pattern Findings

953 matches across 15 categories. Click a row to expand file-level details.

Over-Commented Block816 hits · 727 pts
SeverityFileLineSnippet
LOWCMakeLists.txt141 else()
LOWci/run.sh1#!/bin/bash
LOWinclude/whisper.h1#ifndef WHISPER_H
LOWinclude/whisper.h21# ifdef WHISPER_BUILD
LOWinclude/whisper.h41
LOWinclude/whisper.h61 // }
LOWinclude/whisper.h241 WHISPER_API struct whisper_state * whisper_init_state(struct whisper_context * ctx);
LOWinclude/whisper.h361 // Examples:
LOWtests/run-tests.sh1#!/bin/bash
LOWtests/test-vad-full.cpp1#include "whisper.h"
LOWmodels/convert-h5-to-ggml.py1# Convert Hugging Face fine-tuned models to ggml format
LOWmodels/convert-pt-to-ggml.py1# Convert Whisper transformer model from PyTorch to ggml format
LOWmodels/convert-pt-to-ggml.py21# - mel filters
LOWmodels/convert-pt-to-ggml.py41import numpy as np
LOWmodels/convert-pt-to-ggml.py61# "nl": "dutch",
LOWmodels/convert-pt-to-ggml.py81# "hr": "croatian",
LOWmodels/convert-pt-to-ggml.py101# "is": "icelandic",
LOWmodels/convert-pt-to-ggml.py121# "tg": "tajik",
LOWmodels/convert-pt-to-ggml.py141# "tt": "tatar",
LOWexamples/grammar-parser.h1// Implements a parser for an extended Backus-Naur form (BNF), producing the
LOWexamples/json.hpp21#include <algorithm> // all_of, find, for_each
LOWexamples/json.hpp41// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
LOWexamples/json.hpp61#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
LOWexamples/json.hpp81#if JSON_DIAGNOSTICS
LOWexamples/json.hpp141 {
LOWexamples/json.hpp161#include <algorithm> // transform
LOWexamples/json.hpp181
LOWexamples/json.hpp201#include <array> // array
LOWexamples/json.hpp221// | | |__ | | | | | | version 3.11.2
LOWexamples/json.hpp321// | | |__ | | | | | | version 3.11.2
LOWexamples/json.hpp341#define JSON_HEDLEY_STRINGIFY_EX(x) #x
LOWexamples/json.hpp361#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c
LOWexamples/json.hpp381#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
LOWexamples/json.hpp401 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(ma
LOWexamples/json.hpp421 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
LOWexamples/json.hpp441#endif
LOWexamples/json.hpp461 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)
LOWexamples/json.hpp481 #undef JSON_HEDLEY_SUNPRO_VERSION
LOWexamples/json.hpp501
LOWexamples/json.hpp521#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
LOWexamples/json.hpp541#elif defined(__xlC__) && defined(__xlC_ver__)
LOWexamples/json.hpp561 ( \
LOWexamples/json.hpp581 #undef JSON_HEDLEY_TI_CL2000_VERSION
LOWexamples/json.hpp601#endif
LOWexamples/json.hpp621#endif
LOWexamples/json.hpp641 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)
LOWexamples/json.hpp661 #undef JSON_HEDLEY_TI_CLPRU_VERSION
LOWexamples/json.hpp681 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
LOWexamples/json.hpp701 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VE
LOWexamples/json.hpp721#endif
LOWexamples/json.hpp741#endif
LOWexamples/json.hpp761 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)
LOWexamples/json.hpp781 #undef JSON_HEDLEY_MCST_LCC_VERSION
LOWexamples/json.hpp821#if defined(JSON_HEDLEY_GCC_VERSION)
LOWexamples/json.hpp841 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
LOWexamples/json.hpp861#if \
LOWexamples/json.hpp881#else
LOWexamples/json.hpp901#endif
LOWexamples/json.hpp921#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)
LOWexamples/json.hpp941#endif
756 more matches not shown…
Redundant / Tautological Comments34 hits · 66 pts
SeverityFileLineSnippet
LOWmodels/convert-silero-vad-to-ggml.py146 # Check if this is a convolution weight tensor
LOWmodels/download-ggml-model.sh27# Check if the script is inside a /bin/ directory
LOWmodels/download-ggml-model.sh137# Check if 'whisper-cli' is available in the system PATH
LOWmodels/download-coreml-model.sh24# Check if the script is inside a /bin/ directory
LOWmodels/download-coreml-model.sh88# Check if 'whisper-cli' is available in the system PATH
LOWmodels/download-vad-model.sh24# Check if the script is inside a /bin/ directory
LOWmodels/download-vad-model.sh93# Check if 'whisper-cli' is available in the system PATH
LOWexamples/server.py60 # Check if this is a request to a file in whisper.wasm
LOWexamples/python/whisper_processor.py17 # Check if the file exists
LOWscripts/bench.py128# Check if the sample file exists
LOWscripts/apple/validate-macos.sh685# Check if authentication credentials are provided
LOWscripts/apple/validate-macos.sh704# Check if app was created successfully
LOWscripts/apple/validate-macos.sh712# Check if app binary exists and is executable
LOWscripts/apple/validate-macos.sh720# Check if framework was properly embedded
LOWscripts/apple/validate-macos.sh728# Check if framework binary exists
LOWscripts/apple/validate-visionos.sh679# Check if authentication credentials are provided
LOWscripts/apple/validate-visionos.sh704# Check if validation failed because the app isn't in App Store Connect
LOWscripts/apple/validate-visionos.sh713 # Check if IPA was created successfully
LOWscripts/apple/validate-visionos.sh721 # Check if app binary exists and is executable
LOWscripts/apple/validate-visionos.sh729 # Check if framework was properly embedded
LOWscripts/apple/validate-visionos.sh737 # Check if framework binary exists
LOWscripts/apple/validate-ios.sh688# Check if authentication credentials are provided
LOWscripts/apple/validate-ios.sh713# Check if validation failed because the app isn't in App Store Connect
LOWscripts/apple/validate-ios.sh722 # Check if IPA was created successfully
LOWscripts/apple/validate-ios.sh730 # Check if app binary exists and is executable
LOWscripts/apple/validate-ios.sh738 # Check if framework was properly embedded
LOWscripts/apple/validate-ios.sh746 # Check if framework binary exists
LOWscripts/apple/validate-tvos.sh681# Check if authentication credentials are provided
LOWscripts/apple/validate-tvos.sh706# Check if validation failed because the app isn't in App Store Connect
LOWscripts/apple/validate-tvos.sh715 # Check if IPA was created successfully
LOWscripts/apple/validate-tvos.sh723 # Check if app binary exists and is executable
LOWscripts/apple/validate-tvos.sh731 # Check if framework was properly embedded
LOWscripts/apple/validate-tvos.sh739 # Check if framework binary exists
LOWggml/src/ggml-virtgpu/regenerate_remoting.py46 # Check if clang-format is available
Self-Referential Comments11 hits · 33 pts
SeverityFileLineSnippet
MEDIUMbuild-xcframework.sh384 # Create a separate directory for dSYMs for all platforms
MEDIUMbuild-xcframework.sh392 # Create a copy of the binary that will be stripped
MEDIUMscripts/bench.py18# Define the argument to accept a list
MEDIUMscripts/bench.py54# Define the models, threads, and processor counts to benchmark
MEDIUMscripts/apple/validate-macos.sh571# Create a simple xcscheme file to avoid xcodebuild scheme issues
MEDIUMscripts/apple/validate-macos.sh667# Create a zip file for potential distribution
MEDIUMscripts/apple/validate-visionos.sh565# Create a simple xcscheme file to avoid xcodebuild scheme issues
MEDIUMscripts/apple/validate-ios.sh574# Create a simple xcscheme file to avoid xcodebuild scheme issues
MEDIUMscripts/apple/validate-tvos.sh567# Create a simple xcscheme file to avoid xcodebuild scheme issues
MEDIUM.github/workflows/build.yml838 # Create the directory where the CUDA Toolkit will be installed
MEDIUM.github/workflows/build.yml894 # Create the directory where the CUDA Toolkit will be installed
Verbosity Indicators20 hits · 30 pts
SeverityFileLineSnippet
LOWexamples/talk-llama/llama-sampler.cpp2947 // Step 1: Look for restart sequences to limit the maximum repetition length.
LOWexamples/talk-llama/llama-sampler.cpp3008 // Step 2: Iterate in reverse over the last N tokens of the context, using the "Z-algorithm" (in
LOWexamples/talk-llama/llama-sampler.cpp3072 // Step 3: Iterate over dry_repeat_count and last_tokens, examining the maximum repeat length
LOWexamples/talk-llama/llama-sampler.cpp3099 // Step 4: Apply logit penalties based on the maximum repeat length for relevant tokens.
LOWexamples/talk-llama/models/kimi-linear.cpp197 // Step 1: Q, K, V projections -> [d_inner, n_tokens]
LOWexamples/talk-llama/models/kimi-linear.cpp377 // Step 1: Q projection and reshape
LOWexamples/talk-llama/models/kimi-linear.cpp382 // Step 2: KV compression
LOWggml/src/ggml-webgpu/ggml-webgpu.cpp1290 // For set rows specifically, we need to check if src and idx are empty
LOWggml/src/ggml-cann/aclnn_ops.cpp2809 // Step 5: multiply by attn_factor
LOWggml/src/ggml-cann/aclnn_ops.cpp2826 // Step 6: repeat
LOWggml/src/ggml-cann/aclnn_ops.cpp3090 // Step 1: Prepare trans tensors for F16 type conversion to F32 if needed
LOWggml/src/ggml-cann/aclnn_ops.cpp3115 // Step 2: Prepare head tensors for tail splitting if needed
LOWggml/src/ggml-cann/aclnn_ops.cpp3144 // Step 3: Execute RotaryPositionEmbedding
LOWggml/src/ggml-cann/aclnn_ops.cpp3191 // Step 4: Copy unrotated tail portion from source to destination
LOWggml/src/ggml-cann/aclnn_ops.cpp3220 // Step 5: Cast back to F16 if needed
LOWggml/src/ggml-cann/aclnn_ops.cpp3906 // Step 1: cast the src0 (Query) to fp16 if needed
LOWggml/src/ggml-cann/aclnn_ops.cpp3929 // Step 2: create the acl tensors for src1 (Key), src2 (Value),
LOWggml/src/ggml-cann/aclnn_ops.cpp3973 // Step 3: create the PSEShift tensor if needed
LOWggml/src/ggml-cann/aclnn_ops.cpp4042 // Step 4: set the inputs for FusedInferAttention.
LOWggml/src/ggml-cann/aclnn_ops.cpp4103 // Step 6: post-processing — slice padded output and/or cast to f32
AI Slop Vocabulary8 hits · 24 pts
SeverityFileLineSnippet
MEDIUMexamples/stb_vorbis.c51// 1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory
MEDIUMggml/src/ggml-zendnn/ggml-zendnn.cpp600 // gather + batched matmul + scatter approach. Future versions will leverage
MEDIUMggml/src/ggml-cpu/amx/mmq.cpp603 // pack again with 128 to fully utilize vector length
MEDIUMggml/src/ggml-cpu/amx/mmq.cpp645 // pack again with 128 to fully utilize vector length
MEDIUMggml/src/ggml-cpu/amx/mmq.cpp743 // pack again with 128 to fully utilize vector length
MEDIUMggml/src/ggml-opencl/ggml-opencl.cpp4396 // that wraps around q and d to utilize image access path.
MEDIUMggml/src/ggml-opencl/ggml-opencl.cpp4430 // that wraps around q and d to utilize image access path.
MEDIUMsrc/whisper.cpp8371// guaranteed. Might get removed at some point unless a robust algorithm implementation is found
Excessive Try-Catch Wrapping14 hits · 22 pts
SeverityFileLineSnippet
LOWmodels/convert-pt-to-ggml.py206except Exception:
MEDIUMmodels/convert-pt-to-ggml.py207 print("Error: failed to load PyTorch model file:" , fname_inp)
MEDIUMmodels/convert-pt-to-ggml.py238 print("Error: failed to find either tiktoken or hf_transformers tokenizer file:", tokenizer)
MEDIUMexamples/server.py119 print(f"Error: {e}")
LOWexamples/python/test_whisper_processor.py6except Exception as e:
MEDIUMexamples/python/test_whisper_processor.py7 print(f"Error: {e}")
LOWexamples/python/whisper_processor.py48 except Exception as e:
MEDIUMexamples/python/whisper_processor.py49 print(f"Error: {e}")
MEDIUM…r.swiftui/whisper.swiftui.demo/UI/DownloadButton.swift32 print("Error: \(error.localizedDescription)")
MEDIUM…r.swiftui/whisper.swiftui.demo/UI/DownloadButton.swift48 print("Error: \(err.localizedDescription)")
MEDIUM…r.swiftui/whisper.swiftui.demo/UI/DownloadButton.swift90 print("Error deleting file: \(error)")
LOWggml/src/ggml-virtgpu/regenerate_remoting.py69 except Exception as e:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py327 except Exception as e:
MEDIUMggml/src/ggml-virtgpu/regenerate_remoting.py323def main():
Hyper-Verbose Identifiers19 hits · 20 pts
SeverityFileLineSnippet
LOWtests/earnings21/normalizers/basic.py27def remove_symbols_and_diacritics(s: str, keep=""):
LOWtests/librispeech/normalizers/basic.py27def remove_symbols_and_diacritics(s: str, keep=""):
LOWmodels/convert-whisper-to-coreml.py38def correct_for_bias_scale_order_inversion(state_dict, prefix, local_metadata,
LOWexamples/server.py15class CustomHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
LOW…/wchess.wasm/chessboardjs-1.0.0/js/chessboard-1.0.0.js496 function calculatePositionFromMoves (position, moves) {
LOW…/wchess.wasm/chessboardjs-1.0.0/js/chessboard-1.0.0.js541 function expandConfigArgumentShorthand (config) {
LOW…/wchess.wasm/chessboardjs-1.0.0/js/chessboard-1.0.0.js951 function animateSparePieceToSquare (piece, dest, completeFn) {
LOWbindings/javascript/whisper.js8function GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=HEAP8.buffer){updateMemoryViews()}return HEAP8}function GROWABLE_HEAP_
LOWbindings/ruby/test/test_context_params.rb60 def test_new_with_kw_args_default_values(param)
LOWbindings/ruby/test/test_vad_params.rb83 def test_new_with_kw_args_default_values(param)
LOWbindings/ruby/test/test_params.rb278 def test_new_with_kw_args_default_values(param)
LOWggml/include/ggml-backend.h211 typedef ggml_backend_buffer_type_t (*ggml_backend_split_buffer_type_t)(int main_device, const float * tensor_split
LOWggml/src/ggml-virtgpu/regenerate_remoting.py49 def _check_clang_format_available(self) -> bool:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py53 def _format_file_with_clang_format(self, file_path: Path) -> bool:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py78 def generate_backend_function_name(self, group_name: str, function_name: str) -> str:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py89 def generate_frontend_function_name(self, group_name: str, function_name: str) -> str:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py125 def generate_apir_backend_header(self) -> str:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py176 def generate_backend_dispatched_header(self) -> str:
LOWggml/src/ggml-virtgpu/regenerate_remoting.py222 def generate_virtgpu_forward_header(self) -> str:
Decorative Section Separators4 hits · 18 pts
SeverityFileLineSnippet
MEDIUMexamples/addon.node/CMakeLists.txt4#==================================================================
MEDIUMexamples/addon.node/CMakeLists.txt8#==================================================================
MEDIUMexamples/addon.node/CMakeLists.txt16#==================================================================
MEDIUMexamples/addon.node/CMakeLists.txt24#==================================================================
Synthetic Comment Markers3 hits · 15 pts
SeverityFileLineSnippet
HIGHCONTRIBUTING.md18Code that is initially generated by AI and subsequently edited will still be considered AI-generated. AI assistance is p
HIGHggml/src/ggml-virtgpu/regenerate_remoting.py3# Generated by Claude AI
HIGHggml/src/ggml-hexagon/ggml-hexagon.cpp2484 // Check for F16 support only as requested
Unused Imports11 hits · 11 pts
SeverityFileLineSnippet
LOWtests/earnings21/normalizers/__init__.py1
LOWtests/earnings21/normalizers/__init__.py2
LOWtests/librispeech/normalizers/__init__.py1
LOWtests/librispeech/normalizers/__init__.py2
LOWmodels/convert-h5-to-ggml.py18
LOWmodels/convert-h5-to-ggml.py23
LOWmodels/convert-silero-vad-to-ggml.py4
LOWmodels/convert-pt-to-ggml.py35
LOWmodels/convert-pt-to-ggml.py39
LOWmodels/convert-h5-to-coreml.py13
LOWexamples/server.py6
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippet
CRITICALexamples/wchess/wchess.wasm/jquery-3.7.1.min.js2!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):f
Example Usage Blocks6 hits · 9 pts
SeverityFileLineSnippet
LOWtests/run-tests.sh14# Usage:
LOWmodels/convert-h5-to-ggml.py3# Usage:
LOWexamples/generate-karaoke.sh4# Usage:
LOWexamples/yt-wsp.sh31# Sample usage:
LOWscripts/sync-ggml-am.sh5# Usage:
LOWggml/src/ggml-sycl/dpct/helper.hpp3012 /// Example usage:
Deep Nesting4 hits · 4 pts
SeverityFileLineSnippet
LOWtests/earnings21/normalizers/english.py165
LOWtests/librispeech/normalizers/english.py165
LOWexamples/server.py19
LOWggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py68
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippet
LOWtests/run-tests.sh62# when adding new files, make sure to add the expected "ref.txt" file with the correct transcript
Overly Generic Function Names1 hit · 1 pts
SeverityFileLineSnippet
LOWbindings/javascript/whisper.js8function GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=HEAP8.buffer){updateMemoryViews()}return HEAP8}function GROWABLE_HEAP_