Release original LTF v3.3 epoch 20 inference model
Browse files- demo/app.py +7 -2
- ltf_final/detector.py +1 -1
- release_manifest.json +4 -3
demo/app.py
CHANGED
|
@@ -72,8 +72,13 @@ def resolve_model_dir():
|
|
| 72 |
def verify_model(root):
|
| 73 |
manifest = json.loads((root / 'release_manifest.json').read_text())
|
| 74 |
for relative, expected in manifest['files'].items():
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
raise RuntimeError('The model release is incomplete.')
|
| 78 |
digest = hashlib.sha256()
|
| 79 |
with path.open('rb') as stream:
|
|
|
|
| 72 |
def verify_model(root):
|
| 73 |
manifest = json.loads((root / 'release_manifest.json').read_text())
|
| 74 |
for relative, expected in manifest['files'].items():
|
| 75 |
+
relative_path = Path(relative)
|
| 76 |
+
# Hub snapshot files are symlinks into the sibling blobs directory.
|
| 77 |
+
# Validate the manifest path before following links, then hash the bytes.
|
| 78 |
+
if relative_path.is_absolute() or '..' in relative_path.parts:
|
| 79 |
+
raise RuntimeError('The model manifest contains an invalid path.')
|
| 80 |
+
path = root / relative_path
|
| 81 |
+
if not path.is_file():
|
| 82 |
raise RuntimeError('The model release is incomplete.')
|
| 83 |
digest = hashlib.sha256()
|
| 84 |
with path.open('rb') as stream:
|
ltf_final/detector.py
CHANGED
|
@@ -12,7 +12,7 @@ import yaml
|
|
| 12 |
from model.LTF_v3_3 import LTFNetV3_3
|
| 13 |
from utils.tile_dataset_srm import clip_transform, crop_image_to_tiles
|
| 14 |
|
| 15 |
-
ROOT = Path(__file__).
|
| 16 |
BRANCHES = ('level1', 'level2', 'fusion')
|
| 17 |
|
| 18 |
|
|
|
|
| 12 |
from model.LTF_v3_3 import LTFNetV3_3
|
| 13 |
from utils.tile_dataset_srm import clip_transform, crop_image_to_tiles
|
| 14 |
|
| 15 |
+
ROOT = Path(__file__).absolute().parents[1]
|
| 16 |
BRANCHES = ('level1', 'level2', 'fusion')
|
| 17 |
|
| 18 |
|
release_manifest.json
CHANGED
|
@@ -9,7 +9,8 @@
|
|
| 9 |
"source_note": "Historical release core reconstructed from git 65c18ee5868ced87a27d048261e237632ad5d704; original training-day source snapshot unavailable.",
|
| 10 |
"adaptations": [
|
| 11 |
"Tensor-only checkpoint loading",
|
| 12 |
-
"Portable evaluation configuration"
|
|
|
|
| 13 |
],
|
| 14 |
"files": {
|
| 15 |
"ltf_final/__init__.py": {
|
|
@@ -17,8 +18,8 @@
|
|
| 17 |
"bytes": 175
|
| 18 |
},
|
| 19 |
"ltf_final/detector.py": {
|
| 20 |
-
"sha256": "
|
| 21 |
-
"bytes":
|
| 22 |
},
|
| 23 |
"model/LTF.py": {
|
| 24 |
"sha256": "4e76ed3dcf03cf56ca5c843220e15cddc84d1db2b95c823d8fe8bdab0cc0e279",
|
|
|
|
| 9 |
"source_note": "Historical release core reconstructed from git 65c18ee5868ced87a27d048261e237632ad5d704; original training-day source snapshot unavailable.",
|
| 10 |
"adaptations": [
|
| 11 |
"Tensor-only checkpoint loading",
|
| 12 |
+
"Portable evaluation configuration",
|
| 13 |
+
"Preserve Hub snapshot root when source files are symlinks"
|
| 14 |
],
|
| 15 |
"files": {
|
| 16 |
"ltf_final/__init__.py": {
|
|
|
|
| 18 |
"bytes": 175
|
| 19 |
},
|
| 20 |
"ltf_final/detector.py": {
|
| 21 |
+
"sha256": "998a82c15b253b52905c02201d79b7d92fff30fa95a95c97d48772206d44fb27",
|
| 22 |
+
"bytes": 6074
|
| 23 |
},
|
| 24 |
"model/LTF.py": {
|
| 25 |
"sha256": "4e76ed3dcf03cf56ca5c843220e15cddc84d1db2b95c823d8fe8bdab0cc0e279",
|