Commit
·
c2e3cb4
1
Parent(s):
663c56d
fork hf model
Browse files- handler.py +12 -13
handler.py
CHANGED
|
@@ -37,23 +37,22 @@ from huggingface_hub import hf_hub_download
|
|
| 37 |
|
| 38 |
# end_test
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
# hf_hub_download(
|
| 43 |
-
# repo_id="InstantX/InstantID",
|
| 44 |
-
# filename="ControlNetModel/diffusion_pytorch_model.safetensors",
|
| 45 |
-
# local_dir="./checkpoints",
|
| 46 |
-
# )
|
| 47 |
-
# hf_hub_download(repo_id="InstantX/InstantID", filename="ip-adapter.bin", local_dir="./checkpoints")
|
| 48 |
-
|
| 49 |
-
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 50 |
-
# if device.type != 'cuda':
|
| 51 |
-
# raise ValueError("Se requiere ejecutar en GPU")
|
| 52 |
-
|
| 53 |
-
# dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
| 54 |
|
| 55 |
class EndpointHandler():
|
| 56 |
def __init__(self, model_dir):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
print("Model dir: ", model_dir)
|
| 58 |
pass
|
| 59 |
# face_adapter = f"./checkpoints/ip-adapter.bin"
|
|
|
|
| 37 |
|
| 38 |
# end_test
|
| 39 |
|
| 40 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 41 |
+
if device.type != 'cuda':
|
| 42 |
+
raise ValueError("Se requiere ejecutar en GPU")
|
| 43 |
|
| 44 |
+
dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
class EndpointHandler():
|
| 47 |
def __init__(self, model_dir):
|
| 48 |
+
hf_hub_download(repo_id="InstantX/InstantID", filename="ControlNetModel/config.json", local_dir="./checkpoints")
|
| 49 |
+
hf_hub_download(
|
| 50 |
+
repo_id="InstantX/InstantID",
|
| 51 |
+
filename="ControlNetModel/diffusion_pytorch_model.safetensors",
|
| 52 |
+
local_dir="./checkpoints",
|
| 53 |
+
)
|
| 54 |
+
hf_hub_download(repo_id="InstantX/InstantID", filename="ip-adapter.bin", local_dir="./checkpoints")
|
| 55 |
+
|
| 56 |
print("Model dir: ", model_dir)
|
| 57 |
pass
|
| 58 |
# face_adapter = f"./checkpoints/ip-adapter.bin"
|