MCPcopy Create free account
hub / github.com/argmaxinc/whisperkittools / cli

Function cli

scripts/generate_model.py:27–159  ·  view source on GitHub ↗

f""" Generates Whisper models and publishes them to hf.co/{MODEL_REPO_ID}

()

Source from the content-addressed store, hash-verified

25
26
27def cli():
28 f""" Generates Whisper models and publishes them to hf.co/{MODEL_REPO_ID} """
29 parser = argparse.ArgumentParser()
30 parser.add_argument(
31 "--output-dir",
32 required=True,
33 help="Local directory to save the generated model files and other test artifacts"
34 )
35 parser.add_argument(
36 "--model-version",
37 required=True,
38 help="Whisper model version string that can be either:\n"
39 "1. A Hugging Face model hub name (e.g. openai/whisper-tiny.en)\n"
40 "2. A local directory containing the model files"
41 )
42 parser.add_argument(
43 "--generate-quantized-variants",
44 action="store_true",
45 help="If specified, generates several variants of the model with varying bit precision"
46 )
47 parser.add_argument(
48 "--generate-decoder-context-prefill-data",
49 action="store_true",
50 help="If specified, pre-computes the KV cache for the first 3 tokens of WhisperTextDecoder"
51 )
52 parser.add_argument(
53 "--audio-encoder-sdpa-implementation",
54 default="SplitHeadsQ",
55 choices=tuple(_sdpa.__all__),
56 help="Scaled Dot Product Attention (SDPA) implementation to use for WhisperAudioEncoder"
57 )
58 parser.add_argument(
59 "--text-decoder-sdpa-implementation",
60 default="Cat",
61 choices=tuple(_sdpa.__all__),
62 help="Scaled Dot Product Attention (SDPA) implementation to use for WhisperTextDecoder"
63 )
64 parser.add_argument(
65 "--text-decoder-max-sequence-length",
66 default=None,
67 type=int,
68 help="If specified, overrides the default max sequence length for WhisperTextDecoder"
69 )
70 parser.add_argument(
71 "--repo-path-suffix",
72 default=None,
73 type=str,
74 help=f"If specified, this string gets appended to the folder name on hf.co/{MODEL_REPO_ID}"
75 )
76 parser.add_argument(
77 "--disable-default-tests",
78 action="store_true",
79 help="If specified, disables default tests for WhisperAudioEncoder and WhisperTextDecoder"
80 )
81 parser.add_argument(
82 "--upload-results",
83 action="store_true",
84 help=f"If specified, uplaods the generated models to hf.co/{MODEL_REPO_ID}"

Callers

nothing calls this directly

Calls 3

upload_versionFunction · 0.85

Tested by

no test coverage detected