Keep weights out of Gitea
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -1,5 +0,0 @@
|
|||||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.engine filter=lfs diff=lfs merge=lfs -text
|
|
||||||
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,7 +15,7 @@ __pycache__/
|
|||||||
.ruff_cache/
|
.ruff_cache/
|
||||||
.vite/
|
.vite/
|
||||||
|
|
||||||
# Large runtime assets. Track through Git LFS or release/package storage.
|
# Large runtime assets. Do not push weights to Gitea.
|
||||||
weights/files/
|
weights/files/
|
||||||
*.pt
|
*.pt
|
||||||
*.pth
|
*.pth
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -50,15 +50,16 @@ cd Seg_Data_Server_Net
|
|||||||
python scripts/sync_weights.py --mode copy --hash
|
python scripts/sync_weights.py --mode copy --hash
|
||||||
```
|
```
|
||||||
|
|
||||||
For repository storage, use Git LFS or a Gitea release/package store:
|
Weights must remain local to the deployment machine. Do not push `.pt`, `.pth`,
|
||||||
|
`.onnx`, `.engine`, or `weights/files/` into Gitea. The repository stores only
|
||||||
|
code, `weights/manifest.json`, and helper scripts. Before pushing, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git lfs install
|
scripts/check_no_weight_git.sh
|
||||||
git lfs track "*.pt" "*.pth" "*.onnx" "*.engine"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If Git LFS is not available on the host or server, keep the copied weights on
|
If a deployment machine needs weights, run the sync command locally on that
|
||||||
the deployment volume and commit only `weights/manifest.json`.
|
machine after cloning the code.
|
||||||
|
|
||||||
## Job Types
|
## Job Types
|
||||||
|
|
||||||
@@ -76,4 +77,3 @@ The backend exposes all current Seg capabilities as job types. Examples:
|
|||||||
|
|
||||||
Use `GET /api/catalog` to inspect supported models, algorithms, datasets, and
|
Use `GET /api/catalog` to inspect supported models, algorithms, datasets, and
|
||||||
task types discovered from the existing `Seg/` workspace.
|
task types discovered from the existing `Seg/` workspace.
|
||||||
|
|
||||||
|
|||||||
21
scripts/check_no_weight_git.sh
Executable file
21
scripts/check_no_weight_git.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
cd "${ROOT_DIR}"
|
||||||
|
|
||||||
|
tracked_weights="$(git ls-files | grep -E '(^weights/files/|\.pt$|\.pth$|\.onnx$|\.engine$)' || true)"
|
||||||
|
if [[ -n "${tracked_weights}" ]]; then
|
||||||
|
echo "ERROR: weight files are tracked by git and must not be pushed to Gitea:" >&2
|
||||||
|
echo "${tracked_weights}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
staged_weights="$(git diff --cached --name-only | grep -E '(^weights/files/|\.pt$|\.pth$|\.onnx$|\.engine$)' || true)"
|
||||||
|
if [[ -n "${staged_weights}" ]]; then
|
||||||
|
echo "ERROR: weight files are staged and must not be pushed to Gitea:" >&2
|
||||||
|
echo "${staged_weights}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "OK: no weight files are tracked or staged for Gitea."
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if ! command -v git-lfs >/dev/null 2>&1 && ! git lfs version >/dev/null 2>&1; then
|
|
||||||
echo "git-lfs is not installed on this host." >&2
|
|
||||||
echo "Install git-lfs or publish weights through Gitea releases/packages." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git lfs install
|
|
||||||
git lfs track "*.pt" "*.pth" "*.onnx" "*.engine"
|
|
||||||
git add .gitattributes
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user