chore(ml): remove machine learning model files

This commit is contained in:
MythEclipse
2026-06-11 20:23:57 +07:00
parent 09602b3fe0
commit 3e2f04413e
27 changed files with 1140 additions and 1006 deletions
-6
View File
@@ -1,6 +0,0 @@
best_model/best_model.keras filter=lfs diff=lfs merge=lfs -text
model/saved_model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
model/tfjs_model/*.bin filter=lfs diff=lfs merge=lfs -text
**/best_model.keras filter=lfs diff=lfs merge=lfs -text
**/variables.data* filter=lfs diff=lfs merge=lfs -text
**/tfjs_model/*.bin filter=lfs diff=lfs merge=lfs -text
+11 -13
View File
@@ -28,8 +28,6 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
lfs: true
- name: Set image prefix - name: Set image prefix
run: echo "IMAGE_PREFIX=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" run: echo "IMAGE_PREFIX=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
@@ -37,19 +35,19 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Set up Python for ONNX conversion - name: Download ONNX model from Hugging Face Hub
if: matrix.service.name == 'ml' if: matrix.service.name == 'ml'
uses: actions/setup-python@v5 env:
with: HF_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
python-version: '3.11'
- name: Generate ONNX model artifact
if: matrix.service.name == 'ml'
working-directory: Machine_Learning
run: | run: |
python -m pip install --upgrade pip mkdir -p Machine_Learning/model
python -m pip install 'tensorflow>=2.13.0' 'tf2onnx>=1.16.1' 'onnx>=1.16.0' if [ -n "$HF_TOKEN" ]; then
python convert_onnx.py AUTH_HEADER="-H Authorization: Bearer $HF_TOKEN"
fi
curl -fL $AUTH_HEADER \
"https://huggingface.co/MythEclipse2737/zeavis-edu-model/resolve/main/model/model.onnx" \
-o "Machine_Learning/model/model.onnx"
ls -lh Machine_Learning/model/model.onnx
- name: Log in to GHCR - name: Log in to GHCR
uses: docker/login-action@v3 uses: docker/login-action@v3
+27
View File
@@ -0,0 +1,27 @@
# Durable Memory Wiki
Consolidated knowledge and long-term facts.
## Core Learnings
- **Topic:** error response daemon
**Context:** Failure observation: Exit code 1
Error response from daemon: No such container: telemetry-prometheus
*Promoted on:* 2026-06-11T12:19:50.638Z
- **Topic:** error 32603 pattern
**Context:** Failure observation: MCP error -32603: pattern must be a non-empty string.
*Promoted on:* 2026-06-11T12:19:50.638Z
- **Topic:** traceback recent string
**Context:** Failure observation: Exit code 1
Traceback (most recent call last):
File "<string>", line 25, in <module>
with urllib.request.urlopen(req) as resp:
~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/usr/lib/python3.14/ur
*Promoted on:* 2026-06-11T12:58:56.451Z
- **Topic:** exist current working
**Context:** Failure observation: File does not exist. Note: your current working directory is /mnt/code/ZeaVis-Edu.
*Promoted on:* 2026-06-11T13:03:39.178Z
+9
View File
@@ -0,0 +1,9 @@
# Model artifacts — not stored in git. Uploaded to Hugging Face Hub after training.
best_model/
model/
dataset/
dataset.zip
venv/
__pycache__/
*.pyc
*.pyo
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e8e3a4f86ae1594aeb221c40db3bc80e87c05b05f386bbb628ff1da16397424
size 112903200
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
# Download best_model.keras from Hugging Face Hub.
#
# Usage:
# bash download_model.sh # public repo — no auth needed
# HF_TOKEN=hf_xxx bash download_model.sh # private repo
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEST="${SCRIPT_DIR}/best_model/best_model.keras"
REPO_ID="MythEclipse2737/zeavis-edu-model"
: "${HF_TOKEN:=}"
FORCE="${1:-}"
if [ -f "$DEST" ] && [ "$FORCE" != "--force" ]; then
echo "Model already exists at $DEST (use --force to overwrite)"
exit 0
fi
mkdir -p "$(dirname "$DEST")"
if command -v huggingface-cli &>/dev/null; then
huggingface-cli download "$REPO_ID" "best_model/best_model.keras" --local-dir "$(dirname "$DEST")" $( [ -n "$HF_TOKEN" ] && echo "--token $HF_TOKEN" )
elif command -v hf &>/dev/null; then
hf download "$REPO_ID" "best_model/best_model.keras" --output "$DEST"
elif command -v curl &>/dev/null; then
URL="https://huggingface.co/${REPO_ID}/resolve/main/best_model/best_model.keras"
curl -fL -o "$DEST" $( [ -n "$HF_TOKEN" ] && echo "-H Authorization: Bearer $HF_TOKEN" ) "$URL"
else
echo "ERROR: Need curl or huggingface-cli installed."
exit 1
fi
if [ -f "$DEST" ]; then
echo "Downloaded: $DEST"
ls -lh "$DEST"
else
echo "ERROR: Download failed."
exit 1
fi
Binary file not shown.
@@ -1 +0,0 @@
©©ءّ¸ث‡ق¬§¢¥ؤج™إأà’–‎سèز÷ئخ ’ڑھ¸¥ؤي—·(،وظ—ئƒ„÷ٌ2:10851638082828504866
Binary file not shown.
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e3831052cde64562f0a4e51d5f224c2c819dd625a1d89b35ef58d74b82f1858
size 53214594
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:613179718d653f027cf5e70a02f223b423a98abaffe7120ef626793aec23177f
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:20325958a36f2afdf149083a4a2079aee4725bb3d0c01f96694f617bb7c29a27
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:853bb38c854ff011b06ed98d7037b25501e02a0b718e65159acbbc62e97874ae
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bf9a4b64fb22a0e83a2862f119a61842a72ec8ba15981ece3291b049dd4db11a
size 2432372
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84e7ddbfcf1fd5d55bf1198cc65fb024ff9110e544195779b42281245246b16d
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8d98aa415626d122e2a324d5ffd3a536bcd03f42957114bc23b3d4fc706c7eb8
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30cb3863522eb0e1f1688249f58629ed1e1f03e82d723fde7a13763ade2d60da
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f8fffbfc14379d113100374729ce0236306b6f1aa8b32808e07020adfb3f0a0
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:516a4af1cae907747b7dc91169579a29bd477a99ad4e638fbb205a9b0acaae9d
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76757c0eb38bc7c38c12d8a8ab8ab68b83d17f377cceca985905e5c48dece798
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5f1a2bd449370e6ffd13143d78e6d1b2803df4cbae968fee5ab4244349a64b5
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c79a0792c83c7bcbf8cb2768d3e6d12a928f95506c64c6818698cea0e3f2fec
size 4194304
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c5a36d2a203ece90b2978f5295f42c7a0f9ff72a2edcdbcaa306e67c29b3d72
size 4194304
File diff suppressed because one or more lines are too long
+61 -13
View File
@@ -74,7 +74,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 4,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -134,7 +134,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -190,7 +190,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -256,7 +256,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -328,7 +328,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
@@ -383,7 +383,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
@@ -601,7 +601,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"metadata": { "metadata": {
"id": "s4Trlvno3wny" "id": "s4Trlvno3wny"
}, },
@@ -644,7 +644,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -724,7 +724,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
@@ -781,7 +781,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
@@ -851,7 +851,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": null,
"metadata": { "metadata": {
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
@@ -922,6 +922,44 @@
"plt.tight_layout()\n", "plt.tight_layout()\n",
"plt.show()" "plt.show()"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# ──────────────────────────────────────────────\n",
"# 14. Upload Model ke Hugging Face Hub\n",
"# ──────────────────────────────────────────────\n",
"print(\"Mengunggah model ke Hugging Face Hub...\")\n",
"try:\n",
" from huggingface_hub import HfApi, login\n",
" import os\n",
"\n",
" hf_token = os.environ.get(\"HF_TOKEN\")\n",
" if hf_token:\n",
" login(token=hf_token, add_to_git_credential=False)\n",
"\n",
" api = HfApi()\n",
" model_path = \"/content/best_model/best_model.keras\"\n",
" repo_id = \"MythEclipse2737/zeavis-edu-model\"\n",
"\n",
" if os.path.exists(model_path):\n",
" api.upload_file(\n",
" path_or_fileobj=model_path,\n",
" path_in_repo=\"best_model/best_model.keras\",\n",
" repo_id=repo_id,\n",
" repo_type=\"model\",\n",
" )\n",
" print(f\"✅ Model berhasil diunggah ke https://huggingface.co/{repo_id}\")\n",
" else:\n",
" print(f\"⚠️ {model_path} tidak ditemukan, upload dilewati.\")\n",
"except ImportError:\n",
" print(\"⚠️ huggingface_hub tidak terinstal. Jalankan: pip install huggingface_hub\")\n",
"except Exception as e:\n",
" print(f\"⚠️ Upload gagal: {e}\")"
]
} }
], ],
"metadata": { "metadata": {
@@ -931,11 +969,21 @@
"provenance": [] "provenance": []
}, },
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3" "name": "python3"
}, },
"language_info": { "language_info": {
"name": "python" "codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.13"
} }
}, },
"nbformat": 4, "nbformat": 4,
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -euo pipefail
# Upload exported model artifacts (ONNX, TFLite) to Hugging Face Hub.
#
# Usage:
# bash upload_model.sh
# HF_TOKEN=hf_xxx bash upload_model.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ID="MythEclipse2737/zeavis-edu-model"
: "${HF_TOKEN:=}"
: "${HF_USER:=MythEclipse2737}"
echo "Uploading model artifacts to Hugging Face Hub..."
if ! command -v huggingface-cli &>/dev/null && ! python3 -c "from huggingface_hub import HfApi" 2>/dev/null; then
echo "ERROR: huggingface_hub not installed. pip install huggingface_hub"
exit 1
fi
python3 << PYEOF
import os, sys
sys.path.insert(0, "${SCRIPT_DIR}")
from huggingface_hub import HfApi
api = HfApi(token="${HF_TOKEN}" if "${HF_TOKEN}" else None)
model_dir = "${SCRIPT_DIR}/model"
onnx = os.path.join(model_dir, "model.onnx")
tflite = os.path.join(model_dir, "model.tflite")
saved_model_pb = os.path.join(model_dir, "saved_model", "saved_model.pb")
repo_id = "${REPO_ID}"
files_to_upload = []
for local, remote in [
(onnx, "model/model.onnx"),
(tflite, "model/model.tflite"),
(saved_model_pb, "model/saved_model/saved_model.pb"),
]:
if os.path.isfile(local):
files_to_upload.append((local, remote))
print(f" Queued: {local} -> {remote}")
else:
print(f" Skip (not found): {local}")
for local, remote in files_to_upload:
print(f" Uploading {remote}...")
api.upload_file(
path_or_fileobj=local,
path_in_repo=remote,
repo_id=repo_id,
repo_type="model",
)
print(f" ✅ {remote} uploaded")
if not files_to_upload:
print(" Nothing to upload.")
else:
print(f"Upload complete: https://huggingface.co/{repo_id}")
PYEOF