Commit ·
5e3e75d
1
Parent(s): ba2fff5
load safetensor locally
Browse files- .DS_Store +0 -0
- checkpoints/.DS_Store +0 -0
- checkpoints/config.json +57 -0
- checkpoints/diffusion_pytorch_model.safetensors +3 -0
- checkpoints/ip-adapter.bin +3 -0
- depth_anything/dpt.py +1 -1
- handler.py +0 -9
- requirements.txt +0 -1
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
checkpoints/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
checkpoints/config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "ControlNetModel",
|
| 3 |
+
"_diffusers_version": "0.21.2",
|
| 4 |
+
"_name_or_path": "/mnt/nj-aigc/usr/guiwan/workspace/diffusion_output/face_xl_ipc_v4_2_XiezhenAnimeForeigner/checkpoint-150000/ControlNetModel",
|
| 5 |
+
"act_fn": "silu",
|
| 6 |
+
"addition_embed_type": "text_time",
|
| 7 |
+
"addition_embed_type_num_heads": 64,
|
| 8 |
+
"addition_time_embed_dim": 256,
|
| 9 |
+
"attention_head_dim": [
|
| 10 |
+
5,
|
| 11 |
+
10,
|
| 12 |
+
20
|
| 13 |
+
],
|
| 14 |
+
"block_out_channels": [
|
| 15 |
+
320,
|
| 16 |
+
640,
|
| 17 |
+
1280
|
| 18 |
+
],
|
| 19 |
+
"class_embed_type": null,
|
| 20 |
+
"conditioning_channels": 3,
|
| 21 |
+
"conditioning_embedding_out_channels": [
|
| 22 |
+
16,
|
| 23 |
+
32,
|
| 24 |
+
96,
|
| 25 |
+
256
|
| 26 |
+
],
|
| 27 |
+
"controlnet_conditioning_channel_order": "rgb",
|
| 28 |
+
"cross_attention_dim": 2048,
|
| 29 |
+
"down_block_types": [
|
| 30 |
+
"DownBlock2D",
|
| 31 |
+
"CrossAttnDownBlock2D",
|
| 32 |
+
"CrossAttnDownBlock2D"
|
| 33 |
+
],
|
| 34 |
+
"downsample_padding": 1,
|
| 35 |
+
"encoder_hid_dim": null,
|
| 36 |
+
"encoder_hid_dim_type": null,
|
| 37 |
+
"flip_sin_to_cos": true,
|
| 38 |
+
"freq_shift": 0,
|
| 39 |
+
"global_pool_conditions": false,
|
| 40 |
+
"in_channels": 4,
|
| 41 |
+
"layers_per_block": 2,
|
| 42 |
+
"mid_block_scale_factor": 1,
|
| 43 |
+
"norm_eps": 1e-05,
|
| 44 |
+
"norm_num_groups": 32,
|
| 45 |
+
"num_attention_heads": null,
|
| 46 |
+
"num_class_embeds": null,
|
| 47 |
+
"only_cross_attention": false,
|
| 48 |
+
"projection_class_embeddings_input_dim": 2816,
|
| 49 |
+
"resnet_time_scale_shift": "default",
|
| 50 |
+
"transformer_layers_per_block": [
|
| 51 |
+
1,
|
| 52 |
+
2,
|
| 53 |
+
10
|
| 54 |
+
],
|
| 55 |
+
"upcast_attention": null,
|
| 56 |
+
"use_linear_projection": true
|
| 57 |
+
}
|
checkpoints/diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c8127be9f174101ebdafee9964d856b49b634435cf6daa396d3f593cf0bbbb05
|
| 3 |
+
size 2502139136
|
checkpoints/ip-adapter.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02b3618e36d803784166660520098089a81388e61a93ef8002aa79a5b1c546e1
|
| 3 |
+
size 1691134141
|
depth_anything/dpt.py
CHANGED
|
@@ -146,7 +146,7 @@ class DPT_DINOv2(nn.Module):
|
|
| 146 |
if localhub:
|
| 147 |
self.pretrained = torch.hub.load('../torchhub/facebookresearch_dinov2_main', 'dinov2_{:}14'.format(encoder), source='local', pretrained=False)
|
| 148 |
else:
|
| 149 |
-
self.pretrained = torch.hub.load('
|
| 150 |
|
| 151 |
dim = self.pretrained.blocks[0].attn.qkv.in_features
|
| 152 |
|
|
|
|
| 146 |
if localhub:
|
| 147 |
self.pretrained = torch.hub.load('../torchhub/facebookresearch_dinov2_main', 'dinov2_{:}14'.format(encoder), source='local', pretrained=False)
|
| 148 |
else:
|
| 149 |
+
self.pretrained = torch.hub.load('facebookresearch/dinov2', 'dinov2_{:}14'.format(encoder))
|
| 150 |
|
| 151 |
dim = self.pretrained.blocks[0].attn.qkv.in_features
|
| 152 |
|
handler.py
CHANGED
|
@@ -32,7 +32,6 @@ from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
|
|
| 32 |
from insightface.app import FaceAnalysis
|
| 33 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline, draw_kps
|
| 34 |
from controlnet_aux import OpenposeDetector
|
| 35 |
-
from huggingface_hub import hf_hub_download
|
| 36 |
|
| 37 |
|
| 38 |
# end_test
|
|
@@ -45,14 +44,6 @@ 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 |
face_adapter = f"./checkpoints/ip-adapter.bin"
|
| 58 |
controlnet_path = f"./checkpoints/ControlNetModel"
|
|
|
|
| 32 |
from insightface.app import FaceAnalysis
|
| 33 |
from pipeline_stable_diffusion_xl_instantid_full import StableDiffusionXLInstantIDPipeline, draw_kps
|
| 34 |
from controlnet_aux import OpenposeDetector
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
# end_test
|
|
|
|
| 44 |
|
| 45 |
class EndpointHandler():
|
| 46 |
def __init__(self, model_dir):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
print("Model dir: ", model_dir)
|
| 48 |
face_adapter = f"./checkpoints/ip-adapter.bin"
|
| 49 |
controlnet_path = f"./checkpoints/ControlNetModel"
|
requirements.txt
CHANGED
|
@@ -8,7 +8,6 @@ einops
|
|
| 8 |
onnxruntime-gpu
|
| 9 |
spaces==0.19.4
|
| 10 |
omegaconf
|
| 11 |
-
huggingface-hub==0.20.2
|
| 12 |
opencv-python
|
| 13 |
insightface
|
| 14 |
gradio
|
|
|
|
| 8 |
onnxruntime-gpu
|
| 9 |
spaces==0.19.4
|
| 10 |
omegaconf
|
|
|
|
| 11 |
opencv-python
|
| 12 |
insightface
|
| 13 |
gradio
|