{"id":24373770,"url":"https://github.com/proprietary/forum-spam-filter","last_synced_at":"2026-04-24T00:36:04.186Z","repository":{"id":271047683,"uuid":"909926343","full_name":"proprietary/forum-spam-filter","owner":"proprietary","description":"fine tuning of a DistilBERT model for detecting spam messages","archived":false,"fork":false,"pushed_at":"2025-01-12T19:03:38.000Z","size":329,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T11:17:06.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proprietary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-30T04:36:34.000Z","updated_at":"2025-01-12T19:03:41.000Z","dependencies_parsed_at":"2025-01-05T04:19:01.427Z","dependency_job_id":"76cf33a5-55f5-48c4-8765-912333f3e5b6","html_url":"https://github.com/proprietary/forum-spam-filter","commit_stats":null,"previous_names":["proprietary/forum-spam-filter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/proprietary/forum-spam-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proprietary%2Fforum-spam-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proprietary%2Fforum-spam-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proprietary%2Fforum-spam-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proprietary%2Fforum-spam-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proprietary","download_url":"https://codeload.github.com/proprietary/forum-spam-filter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proprietary%2Fforum-spam-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32204710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T00:06:41.111Z","status":"ssl_error","status_checked_at":"2026-04-24T00:06:35.224Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-19T05:12:35.338Z","updated_at":"2026-04-24T00:36:04.147Z","avatar_url":"https://github.com/proprietary.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DistilBERT model for detecting spam messages\n\nThis trains and runs a DistilBERT model to classify text as spam. The\nuse case is to develop a plugin to stop spam in forums or blog\ncomments.\n\nThis model is very compact—for a transformer model—and can run\ninference tasks on a low-powered ARM64 CPU with as little as 1-2GB of\nmemory.\n\n## Architecture\n\n```mermaid\ngraph TD\n    subgraph ML Pipeline\n        A[Clean Data from Public \u0026 Private Sources]\n        B[Train Base DistilBERT Model with PyTorch]\n        C[Export Model as ONNX]\n        A --\u003e B --\u003e C\n    end\n    \n    subgraph Inference Application\n        D[Load ONNX Model]\n        E[Load Tokenizer Config]\n        F[Expose gRPC Service for Inference]\n        G[Run as Persistent System Process]\n        D --\u003e E --\u003e F --\u003e G\n    end\n    \n    subgraph PHP Plugin\n        H[Listen for New Comments from Suspicious Users]\n        I[Call Inference App over gRPC]\n        J[Accept or Reject Comment]\n        H --\u003e I --\u003e J\n    end\n\n    C --\u003e D\n    I --\u003e F\n```\n\n## ML\n\n### Training\n\nThis model was trained on both public and private datasets. The code to reproduce the training step is included in this repository.\n\nIt is a DistilBERT model fine-tuned from the original `distilbert-base-uncased`.\n\n### Pretrained model\n\nA pretrained model is available [in this repository](./results/onnx_quantized/model_quantized.onnx)\n\nNote: This model is quantized for the ARM64 instruction set.\n\n## Setup and usage\n\n### gRPC server\n\nThe easiest way to get started is with Docker.\n\n```bash\ndocker build -t forum-spam-filter .\ndocker run --rm -p 60066:60066 forum-spam-filter\n```\n\nThen in a separate shell, test out the server with a tool like [grpcurl](https://github.com/fullstorydev/grpcurl):\n\n```bash\ngrpcurl -plaintext -import-path ./proto -proto spam_classifier.proto \\\n  -d '{\"text\": \"As a valued part of our community, you are eligible for an exclusive airdrop of 10.3 million OP tokens reserved just for engaged members like you.\"}' \\\n  '[::]:60066' \\\n  forum_spam_filter.SpamClassification/Classify\n```\n\nwhich returns the output:\n\n```json\n{\n  \"probability\": 0.99896145\n}\n```\n\nYou can integrate this into your system however you like. The\n[proto/](proto/) directory contains the protobuf definitions necessary\nto generate client code.\n\nAn Ansible role is included in [tools/ansible/](./tools/ansible) which\nyou may find helpful to set up and install the gRPC server without\nusing Docker.\n\n### phpBB3 forum extension\n\nThis also includes [an extension for the phpBB3 forum\nsoftware](./phpbb3_extension) which automatically disapproves posts\nwhich are classified as spam.\n\n### CLI (advanced)\n\n```bash\n# Install shared libraries for the ONNX Runtime\n\nmkdir ./onnxruntime\n\n# Choose a release for your platform from https://github.com/microsoft/onnxruntime/releases\n\n# Linux x86_64\ncurl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-arm64-1.20.1.tgz \\\n  | tar -xz --strip-components=1 -C ./onnxruntime\nexport ORT_DYLIB_PATH=$PWD/onnxruntime/lib/onnxruntime.so\n\n# macOS aarch64\ncurl -L https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-arm64-1.20.1.tgz \\\n  | tar -xz --strip-components=1 -C ./onnxruntime\nexport ORT_DYLIB_PATH=$PWD/onnxruntime/lib/onnxruntime.dylib\n\n# Build Rust binary\ncargo build --release --bin cli\n```\n\nThen you can run it like this:\n\n```bash\n$ export MODEL_PATH=$PWD/results/onnx_quantized/model_quantized.onnx\n$ cat \u003c\u003cEOF | ./target/release/cli\nAs a valued part of our community, you are eligible for an exclusive airdrop of 10.3 million OP tokens reserved just for engaged members like you.\nEOF\n\nSpam: 99.90%\nPredicted Class: \"Spam\"\n```\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproprietary%2Fforum-spam-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproprietary%2Fforum-spam-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproprietary%2Fforum-spam-filter/lists"}