2024-01-12 12:11:04 +00:00
|
|
|
#!/bin/sh
|
2023-04-15 10:21:27 +00:00
|
|
|
#
|
|
|
|
# This generates:
|
2024-06-26 16:34:09 +00:00
|
|
|
# - src/coreml/whisper-encoder-impl.h and src/coreml/whisper-encoder-impl.m
|
|
|
|
# - src/coreml/whisper-decoder-impl.h and src/coreml/whisper-decoder-impl.m
|
2023-04-15 10:21:27 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
wd=$(dirname "$0")
|
2024-01-12 12:11:04 +00:00
|
|
|
cd "$wd/../" || exit
|
2023-04-15 10:21:27 +00:00
|
|
|
|
|
|
|
python3 models/convert-whisper-to-coreml.py --model tiny.en
|
|
|
|
|
|
|
|
mv -v models/coreml-encoder-tiny.en.mlpackage models/whisper-encoder-impl.mlpackage
|
2024-06-26 16:34:09 +00:00
|
|
|
xcrun coremlc generate models/whisper-encoder-impl.mlpackage src/coreml/
|
|
|
|
mv src/coreml/whisper_encoder_impl.h src/coreml/whisper-encoder-impl.h
|
|
|
|
mv src/coreml/whisper_encoder_impl.m src/coreml/whisper-encoder-impl.m
|
|
|
|
sed -i '' 's/whisper_encoder_impl\.h/whisper-encoder-impl.h/g' src/coreml/whisper-encoder-impl.m
|
|
|
|
sed -i '' 's/whisper_encoder_impl\.m/whisper-encoder-impl.m/g' src/coreml/whisper-encoder-impl.m
|
|
|
|
sed -i '' 's/whisper_encoder_impl\.h/whisper-encoder-impl.h/g' src/coreml/whisper-encoder-impl.h
|
2023-04-15 10:21:27 +00:00
|
|
|
|
|
|
|
mv -v models/coreml-decoder-tiny.en.mlpackage models/whisper-decoder-impl.mlpackage
|
2024-06-26 16:34:09 +00:00
|
|
|
xcrun coremlc generate models/whisper-decoder-impl.mlpackage src/coreml/
|
|
|
|
mv src/coreml/whisper_decoder_impl.h src/coreml/whisper-decoder-impl.h
|
|
|
|
mv src/coreml/whisper_decoder_impl.m src/coreml/whisper-decoder-impl.m
|
|
|
|
sed -i '' 's/whisper_decoder_impl\.h/whisper-decoder-impl.h/g' src/coreml/whisper-decoder-impl.m
|
|
|
|
sed -i '' 's/whisper_decoder_impl\.m/whisper-decoder-impl.m/g' src/coreml/whisper-decoder-impl.m
|
|
|
|
sed -i '' 's/whisper_decoder_impl\.h/whisper-decoder-impl.h/g' src/coreml/whisper-decoder-impl.h
|
2023-04-15 10:21:27 +00:00
|
|
|
|
|
|
|
rm -rfv models/whisper-encoder-impl.mlpackage models/whisper-decoder-impl.mlpackage
|