Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from typing import Tuple, Optional
|
|
10 |
|
11 |
from PIL import Image
|
12 |
from gradio_imageslider import ImageSlider
|
13 |
-
from transformers import AutoModelForImageSegmentation,
|
14 |
from torchvision import transforms
|
15 |
|
16 |
import requests
|
@@ -18,8 +18,8 @@ from io import BytesIO
|
|
18 |
import zipfile
|
19 |
import random
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
|
24 |
torch.set_float32_matmul_precision('high')
|
25 |
torch.jit.script = lambda f: f
|
@@ -80,7 +80,7 @@ usage_to_weights_file = {
|
|
80 |
|
81 |
# 초기 모델 로딩 (기본: General)
|
82 |
birefnet = AutoModelForImageSegmentation.from_pretrained(
|
83 |
-
'/'.join(('zhengpeng7', usage_to_weights_file['General'])),
|
84 |
trust_remote_code=True
|
85 |
)
|
86 |
birefnet.to(device)
|
|
|
10 |
|
11 |
from PIL import Image
|
12 |
from gradio_imageslider import ImageSlider
|
13 |
+
from transformers import AutoModelForImageSegmentation, PreTrainedModel
|
14 |
from torchvision import transforms
|
15 |
|
16 |
import requests
|
|
|
18 |
import zipfile
|
19 |
import random
|
20 |
|
21 |
+
# 오버라이드: tie_weights()를 빈 함수로 재정의하여 tie_weights 호출을 무시함.
|
22 |
+
PreTrainedModel.tie_weights = lambda self: None
|
23 |
|
24 |
torch.set_float32_matmul_precision('high')
|
25 |
torch.jit.script = lambda f: f
|
|
|
80 |
|
81 |
# 초기 모델 로딩 (기본: General)
|
82 |
birefnet = AutoModelForImageSegmentation.from_pretrained(
|
83 |
+
'/'.join(('zhengpeng7', usage_to_weights_file['General'])),
|
84 |
trust_remote_code=True
|
85 |
)
|
86 |
birefnet.to(device)
|