diff --git a/.github/workflows/build-steps.yml b/.github/workflows/build-steps.yml index 5510da8..860f4a2 100644 --- a/.github/workflows/build-steps.yml +++ b/.github/workflows/build-steps.yml @@ -32,8 +32,17 @@ jobs: run: | python3 test.py + - name: assets + run: | + python3 assets.py + - name: Upload artifact uses: actions/upload-artifact@v3 with: name: whisper.tflite - path: whisper.tflite \ No newline at end of file + path: | + vocab.json + tokenizer.json + merges.txt + normalizer.json + whisper.tflite \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d37233b..7c2d6ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,8 @@ jobs: - name: zip run: | - zip whisper.tflite-${{ github.event.release.tag_name }}.zip whisper.tflite + ls -la + zip whisper.tflite-${{ github.event.release.tag_name }}.zip whisper.tflite merges.txt normalizer.json tokenizer.json vocab.json - name: Upload release package uses: actions/upload-release-asset@v1 diff --git a/.gitignore b/.gitignore index ea80a3b..c5746f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ .venv tf_whisper_saved -*.tflite \ No newline at end of file +*.tflite +merges.txt +normalizer.json +tokenizer.json +vocab.json \ No newline at end of file diff --git a/assets.py b/assets.py new file mode 100644 index 0000000..02f643a --- /dev/null +++ b/assets.py @@ -0,0 +1,15 @@ +import logging +import os.path +import shutil +from settings import model_name, tflite_model_path +from transformers import WhisperProcessor, WhisperTokenizer +from transformers.utils import cached_file + +logging.basicConfig(level=logging.DEBUG) + +processor = WhisperProcessor.from_pretrained(model_name) +tokenizer = processor.tokenizer + +for asset in [cached_file(model_name, f) for f in tokenizer.vocab_files_names.values()]: + print(os.path.basename(asset)) + shutil.copy(asset, os.path.basename(asset))