Upload folder using huggingface_hub
Browse files- .idea/workspace.xml +1 -1
- app.py +19 -16
.idea/workspace.xml
CHANGED
|
@@ -54,7 +54,7 @@
|
|
| 54 |
<option name="number" value="Default" />
|
| 55 |
<option name="presentableId" value="Default" />
|
| 56 |
<updated>1760056680813</updated>
|
| 57 |
-
<workItem from="1760056681869" duration="
|
| 58 |
</task>
|
| 59 |
<servers />
|
| 60 |
</component>
|
|
|
|
| 54 |
<option name="number" value="Default" />
|
| 55 |
<option name="presentableId" value="Default" />
|
| 56 |
<updated>1760056680813</updated>
|
| 57 |
+
<workItem from="1760056681869" duration="4202000" />
|
| 58 |
</task>
|
| 59 |
<servers />
|
| 60 |
</component>
|
app.py
CHANGED
|
@@ -19,22 +19,6 @@ from scripts.camera.visualization.visualize_batch import make_perspective_figure
|
|
| 19 |
|
| 20 |
from huggingface_hub import snapshot_download
|
| 21 |
import os
|
| 22 |
-
_ = snapshot_download(
|
| 23 |
-
repo_id="KangLiao/Puffin",
|
| 24 |
-
repo_type="model",
|
| 25 |
-
#filename="Puffin-Base.pth",
|
| 26 |
-
local_dir="checkpoints/",
|
| 27 |
-
local_dir_use_symlinks=False,
|
| 28 |
-
revision="main",
|
| 29 |
-
)
|
| 30 |
-
_ = snapshot_download(
|
| 31 |
-
repo_id="wusize/Puffin",
|
| 32 |
-
repo_type="model",
|
| 33 |
-
#filename="Puffin-Base.pth",
|
| 34 |
-
local_dir="checkpoints/",
|
| 35 |
-
local_dir_use_symlinks=False,
|
| 36 |
-
revision="main",
|
| 37 |
-
)
|
| 38 |
|
| 39 |
NUM = r"[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?"
|
| 40 |
CAM_PATTERN = re.compile(r"(?:camera parameters.*?:|roll.*?:)\s*("+NUM+r")\s*,\s*("+NUM+r")\s*,\s*("+NUM+r")", re.IGNORECASE|re.DOTALL)
|
|
@@ -51,10 +35,29 @@ def center_crop(image):
|
|
| 51 |
config = "configs/pipelines/stage_2_base.py"
|
| 52 |
config = Config.fromfile(config)
|
| 53 |
model = BUILDER.build(config.model).eval()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
checkpoint_path = "checkpoints/Puffin-Base.pth"
|
| 55 |
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
| 56 |
_ = model.load_state_dict(checkpoint, strict=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
_ = model.vae.load_state_dict(torch.load('checkpoints/vae.pth', map_location='cpu'), strict=True)
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
if torch.cuda.is_available():
|
|
|
|
| 19 |
|
| 20 |
from huggingface_hub import snapshot_download
|
| 21 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
NUM = r"[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?"
|
| 24 |
CAM_PATTERN = re.compile(r"(?:camera parameters.*?:|roll.*?:)\s*("+NUM+r")\s*,\s*("+NUM+r")\s*,\s*("+NUM+r")", re.IGNORECASE|re.DOTALL)
|
|
|
|
| 35 |
config = "configs/pipelines/stage_2_base.py"
|
| 36 |
config = Config.fromfile(config)
|
| 37 |
model = BUILDER.build(config.model).eval()
|
| 38 |
+
_ = snapshot_download(
|
| 39 |
+
repo_id="KangLiao/Puffin",
|
| 40 |
+
repo_type="model",
|
| 41 |
+
allow_patterns="Puffin-Base.pth",
|
| 42 |
+
local_dir="checkpoints/",
|
| 43 |
+
local_dir_use_symlinks=False,
|
| 44 |
+
revision="main",
|
| 45 |
+
)
|
| 46 |
checkpoint_path = "checkpoints/Puffin-Base.pth"
|
| 47 |
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
| 48 |
_ = model.load_state_dict(checkpoint, strict=False)
|
| 49 |
+
|
| 50 |
+
os.remove(checkpoint)
|
| 51 |
+
|
| 52 |
+
_ = snapshot_download(
|
| 53 |
+
repo_id="wusize/Puffin",
|
| 54 |
+
repo_type="model",
|
| 55 |
+
local_dir="checkpoints/",
|
| 56 |
+
local_dir_use_symlinks=False,
|
| 57 |
+
revision="main",
|
| 58 |
+
)
|
| 59 |
_ = model.vae.load_state_dict(torch.load('checkpoints/vae.pth', map_location='cpu'), strict=True)
|
| 60 |
+
os.remove('checkpoints/vae.pth')
|
| 61 |
|
| 62 |
|
| 63 |
if torch.cuda.is_available():
|