Spaces:
Sleeping
Sleeping
demo custom mask
Browse files
__pycache__/inference.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/inference.cpython-310.pyc and b/__pycache__/inference.cpython-310.pyc differ
|
|
|
inference.py
CHANGED
|
@@ -32,6 +32,16 @@ STANDARD_12_LEAD_NAMES: tuple[str, ...] = (
|
|
| 32 |
)
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
def load_pipeline(
|
| 36 |
checkpoint_path: str | Path,
|
| 37 |
device: torch.device | str | None = None,
|
|
@@ -40,6 +50,12 @@ def load_pipeline(
|
|
| 40 |
"""Load ``MAEReconstructionPipeline`` weights from a training checkpoint dict."""
|
| 41 |
checkpoint_path = Path(checkpoint_path)
|
| 42 |
device = torch.device(device or ("cuda" if torch.cuda.is_available() else "cpu"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
ckpt = torch.load(checkpoint_path, map_location=device, weights_only=False)
|
| 44 |
cfg = config or ckpt.get("config")
|
| 45 |
if cfg is None:
|
|
|
|
| 32 |
)
|
| 33 |
|
| 34 |
|
| 35 |
+
def _is_git_lfs_pointer_file(path: Path) -> bool:
|
| 36 |
+
"""True if ``path`` is a Git LFS stub (text pointer) instead of the real blob."""
|
| 37 |
+
try:
|
| 38 |
+
with path.open("r", encoding="ascii", errors="replace") as f:
|
| 39 |
+
head = f.read(128)
|
| 40 |
+
except OSError:
|
| 41 |
+
return False
|
| 42 |
+
return head.startswith("version https://git-lfs.github.com/spec/v1")
|
| 43 |
+
|
| 44 |
+
|
| 45 |
def load_pipeline(
|
| 46 |
checkpoint_path: str | Path,
|
| 47 |
device: torch.device | str | None = None,
|
|
|
|
| 50 |
"""Load ``MAEReconstructionPipeline`` weights from a training checkpoint dict."""
|
| 51 |
checkpoint_path = Path(checkpoint_path)
|
| 52 |
device = torch.device(device or ("cuda" if torch.cuda.is_available() else "cpu"))
|
| 53 |
+
if _is_git_lfs_pointer_file(checkpoint_path):
|
| 54 |
+
raise RuntimeError(
|
| 55 |
+
f"{checkpoint_path} is a Git LFS pointer file, not checkpoint bytes. "
|
| 56 |
+
"Install Git LFS if needed, then run: git lfs pull\n"
|
| 57 |
+
"Or place a real checkpoint .pt at this path (e.g. from runs/ after training)."
|
| 58 |
+
)
|
| 59 |
ckpt = torch.load(checkpoint_path, map_location=device, weights_only=False)
|
| 60 |
cfg = config or ckpt.get("config")
|
| 61 |
if cfg is None:
|
mae/__pycache__/model.cpython-310.pyc
CHANGED
|
Binary files a/mae/__pycache__/model.cpython-310.pyc and b/mae/__pycache__/model.cpython-310.pyc differ
|
|
|
mae/__pycache__/pipeline.cpython-310.pyc
CHANGED
|
Binary files a/mae/__pycache__/pipeline.cpython-310.pyc and b/mae/__pycache__/pipeline.cpython-310.pyc differ
|
|
|
visualization.ipynb
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|