Skip to content

Cli reconvert#357

Merged
HenryNdubuaku merged 3 commits intomainfrom
cli_reconvert
Feb 16, 2026
Merged

Cli reconvert#357
HenryNdubuaku merged 3 commits intomainfrom
cli_reconvert

Conversation

@jakmro
Copy link
Copy Markdown
Collaborator

@jakmro jakmro commented Feb 16, 2026

No description provided.

@jakmro jakmro marked this pull request as ready for review February 16, 2026 06:12
Copilot AI review requested due to automatic review settings February 16, 2026 06:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CLI and publishing workflow to support downloading pre-converted model weights from a Hugging Face org by default (with an option to force reconversion), and refactors the Hugging Face publishing script/workflow to publish models individually (optionally including Apple exports).

Changes:

  • Default CLI download path now attempts to fetch pre-converted weights from a Hugging Face org, with --reconvert to force source conversion.
  • Refactors publish_to_hf.py to publish a single model per invocation (via --task export_model) and optionally export Apple weights (--apple).
  • Updates VAD default model ID to snakers4/silero-vad and modernizes the publish GitHub Action to accept workflow inputs + publish lists from env.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
tests/run.sh Updates default VAD model ID used by the test runner.
python/src/publish_to_hf.py Refactors publishing into explicit tasks; adds per-model publish flow and optional Apple export zip generation.
python/src/cli.py Adds HF pre-converted weights download flow and --reconvert flag plumbing across commands.
.github/workflows/publish_to_hf.yml Adds workflow_dispatch inputs, moves model lists into env, publishes models in a loop, and updates org README separately.
Comments suppressed due to low confidence (2)

python/src/publish_to_hf.py:250

  • main() returns status codes, but __main__ calls main() without sys.exit(...), so the process will always exit 0 and the GitHub Action can succeed even when publishing fails. Import sys and call sys.exit(main()) (or otherwise propagate the return code).
if __name__ == "__main__":
    main()

python/src/publish_to_hf.py:107

  • The log message "Failed to export pro weights" is now triggered by the --apple path and is confusing. Also, export_pro_weights() can return None, which will raise inside shutil.move(...) and get swallowed. Consider explicitly handling the None case and updating the message to reflect Apple export, optionally including the underlying exception for debugging.
    if export_apple:
        try:
            mlpackage = export_pro_weights(model_id, bits)

            shutil.move(mlpackage, weights_out)

            model_pro_zip = stage / "weights" / f"{model_name_lower}-apple.zip"
            zip_dir(weights_out, model_pro_zip)

            fingerprint.update(sha256(model_pro_zip).encode())
            config["bits"] = bits
        except Exception:
            print("Failed to export pro weights")


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to +96
print_color(YELLOW, "Extracting model weights...")
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(weights_dir)
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zipfile.ZipFile.extractall() is used on a downloaded zip without validating member paths. A malicious zip can write outside weights_dir (Zip Slip). Validate that each member resolves within weights_dir (or implement a safe extraction helper) before extracting.

Copilot uses AI. Check for mistakes.
Comment on lines +92 to +96
weights_dir.mkdir(parents=True, exist_ok=True)

print_color(YELLOW, "Extracting model weights...")
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(weights_dir)
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download_from_hf() extracts into weights_dir without clearing it first. If weights_dir already exists but is incomplete/corrupt (e.g., missing config.txt), this can mix old and new files and still fail later. Consider removing the directory (or extracting into a temp dir and atomically replacing) before extractall().

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +67
model_name = get_model_dir_name(model_id)
org = "cactus-compute"
repo_id = f"{org}/{model_id.split('/')[-1]}"
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Hugging Face org is hard-coded as cactus-compute here, while the publish workflow defaults to Cactus-Compute. If the namespace casing differs, downloads will fail. Consider making the org configurable (flag/env) and/or using a single constant shared with the publishing path.

Copilot uses AI. Check for mistakes.
org:
description: Organization
required: false
default: Cactus-Compute
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow defaults the publish org to Cactus-Compute, but the CLI download path expects pre-converted weights under cactus-compute. If these differ on Hugging Face, publishing and downloads won’t line up. Align the default org (and casing) across tooling, or pass the same org value into both publishing and download logic.

Suggested change
default: Cactus-Compute
default: cactus-compute

Copilot uses AI. Check for mistakes.
@HenryNdubuaku HenryNdubuaku merged commit 1d6df24 into main Feb 16, 2026
7 of 8 checks passed
ncylich pushed a commit that referenced this pull request Feb 24, 2026
* pre-converted model downloads from HuggingFace

Signed-off-by: jakmro <[email protected]>

* clean

Signed-off-by: jakmro <[email protected]>

---------

Signed-off-by: jakmro <[email protected]>
cattermelon1234 pushed a commit to cattermelon1234/cactus that referenced this pull request Feb 28, 2026
* pre-converted model downloads from HuggingFace

Signed-off-by: jakmro <[email protected]>

* clean

Signed-off-by: jakmro <[email protected]>

---------

Signed-off-by: jakmro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants