Repository navigation
Publish the int8 ONNX model on Hugging Face Hub and load it from there - #15
Merged
Merged
Conversation
onnxruntime was in no requirements file, so a fresh install could not run the int8 model. requirements-onnx.txt pins onnxruntime and transformers (no torch); verified on Python 3.11 with identical predictions on 500 validation messages. requirements-ml.txt gains onnx and onnxruntime for export and quantisation.
…ecksum-verified configs/model_hub.json pins the repository, the revision and a SHA-256 for every file. scripts/download_model.py fetches them; the registry does the same on first start when the model is requested but absent, only if onnxruntime is installed, and falls back to the baseline on any failure. A corrupt or truncated download is rejected and never left in place.
Uploads exactly the four files the app needs, the model card and SHA256SUMS, refuses files that do not match the manifest, reads HF_TOKEN from the environment only, and records the published revision in the manifest. The card covers training data and licences, validation-only evaluation, limitations and the Built with Qwen notice required by the Qwen Research License.
…otice The Colab notebook trained only the un-augmented encoder; it now also builds the augmented set, trains, exports and quantises the published model, and downloads the four files.
pavan-dangeti/scamshield-xlmr-int8 at 34160516e72121848b4622fdb727b7f33c00101b.
The first clean-folder download from the Hub dropped after 34 MB of 278 MB (IncompleteRead). Downloads now go to a .part file and resume with an HTTP range request, up to four attempts; the checksum still covers the whole file and nothing is left behind on failure.
pavan-dangeti/scamshield-xlmr-int8, CC BY-NC 4.0. Verified from a clean clone: the server fetched all four files at the pinned revision on first start, they pass the Hub's SHA256SUMS, and it served the int8 model.
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.
Publishes the int8 ONNX XLM-R model and lets the app load it from Hugging Face Hub.
Model: pavan-dangeti/scamshield-xlmr-int8 at revision
34160516e72121848b4622fdb727b7f33c00101b, CC BY-NC 4.0 with the Built with Qwen notice.What this adds
src/model_hub.py+configs/model_hub.json: fetch the model at the pinned revision, verifying every file's SHA-256. Interrupted downloads resume with an HTTP range request (up to 4 attempts); a corrupt or truncated file is rejected and nothing partial is left on disk.SCAMSHIELD_MODEL=xlmr-aug-int8and the files are absent, only ifonnxruntimeis installed, and falls back to the baseline on any failure. The live demo (baseline) is unaffected.scripts/download_model.pyandscripts/publish_model.py(token fromHF_TOKENonly; refuses files that differ from the manifest;--new-artefactfor retrained models).docs/hub_model_card.md: the Hub model card (training data and licences, validation-only evaluation, limitations, Built with Qwen).requirements-onnx.txt:onnxruntimewas in no requirements file, so a fresh install could not run the model.How it was checked
models/directory and a new Python 3.11 env with onlyrequirements-onnx.txt. Started withSCAMSHIELD_MODEL=xlmr-aug-int8, the server downloaded all four files from the Hub,/api/healthreportedxlmr-aug-int8, and/api/analyzeserved it. The files pass the Hub'sSHA256SUMS(shasum -c).IncompleteRead); that is why downloads now resume. Tested with a simulated mid-transfer drop and with repeated failures.requirements-onnx.txtgives identical decisions, tactics and probabilities on 500 validation messages vs. the existing environment; the model card's code example runs as written.pytest102 passed, including with all network access blocked (no test downloads anything) · ruff · vulture · mypy clean.