Conversation
danbev
reviewed
Jun 21, 2025
|
|
||
| base, ext = os.path.splitext(output_path) | ||
| output_file = f"{base}-v{silero_version}-ggml{ext}" | ||
| output_file = f"ggml-{base}-v{silero_version}{ext}" |
Member
There was a problem hiding this comment.
I think the ggml prefix should come before the file name and not before the path to the models directory:
Suggested change
| output_file = f"ggml-{base}-v{silero_version}{ext}" | |
| output_file = f"{base}ggml-v{silero_version}{ext}" |
Member
There was a problem hiding this comment.
I think that we should perhaps change this to have a default value for the --output parameter, and then just allow it to be overridden by anything that the user wants. I'm not sure why I did not do that at the time.
Something like:
diff --git a/models/convert-silero-vad-to-ggml.py b/models/convert-silero-vad-to-ggml.py
index 9d3afd4c..b9fb549e 100644
--- a/models/convert-silero-vad-to-ggml.py
+++ b/models/convert-silero-vad-to-ggml.py
@@ -19,16 +19,15 @@ def convert_silero_vad(output_path, print_tensors=True):
clean_key = "_model." + key
cleaned_dict[clean_key] = value
- base, ext = os.path.splitext(output_path)
- output_file = f"ggml-{base}-v{silero_version}{ext}"
- print(f"Saving GGML Silero-VAD model to {output_file}")
+ print(f"Saving GGML Silero-VAD model to {output_path}")
print("\nTensor info for debugging:")
for key, tensor in cleaned_dict.items():
print(f" - {key}: {tensor.shape} ({tensor.dtype})")
print()
- with open(output_file, "wb") as fout:
+ print(f"output_file: {output_path}")
+ with open(output_path, "wb") as fout:
# Write magic and version
fout.write(struct.pack("i", 0x67676d6c))
@@ -184,12 +183,12 @@ def convert_silero_vad(output_path, print_tensors=True):
print(f" Wrote {data.size * (2 if ftype==1 else 4)} bytes")
- print(f"\nDone! Model has been converted to GGML format: {output_file}")
- print(f"File size: {os.path.getsize(output_file)} bytes")
+ print(f"\nDone! Model has been converted to GGML format: {output_path}")
+ print(f"File size: {os.path.getsize(output_path)} bytes")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Convert Silero-VAD PyTorch model to GGML format")
- parser.add_argument("--output", type=str, required=True, help="Path to output GGML model file")
+ parser.add_argument("--output", type=str, default=f"models/ggml-v{silero_version}.bin", help="Path to output GGML model file")
parser.add_argument("--print-tensors", action="store_true", help="Print tensor values", default=True)
args = parser.parse_args()
This would allow the conversion to be run as:
(venv) $ python models/convert-silero-vad-to-ggml.py
Saving GGML Silero-VAD model to models/ggml-v5.1.2.bin
...This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated the VAD model download path to use names starting with the ggml prefix (currently the shell script downloads models this way, but the Python script wasn't updated — this MR unifies the path naming).
Updated the model path in the VAD usage section of the README accordingly.