ZhengPeng7 commited on
Commit
66f7f80
·
1 Parent(s): 1d30e9f

Fix the wrong bb setting. Fix the bug by latest transformers and update req.txt.

Browse files
Files changed (3) hide show
  1. birefnet.py +2 -1
  2. handler.py +2 -1
  3. requirements.txt +2 -4
birefnet.py CHANGED
@@ -2,9 +2,10 @@
2
 
3
  import os
4
  import math
 
5
 
6
 
7
- class Config():
8
  def __init__(self) -> None:
9
  # PATH settings
10
  self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
 
2
 
3
  import os
4
  import math
5
+ from transformers import PretrainedConfig
6
 
7
 
8
+ class Config(PretrainedConfig):
9
  def __init__(self) -> None:
10
  # PATH settings
11
  self.sys_home_dir = os.path.expanduser('~') # Make up your file system as: SYS_HOME_DIR/codes/dis/BiRefNet, SYS_HOME_DIR/datasets/dis/xx, SYS_HOME_DIR/weights/xx
handler.py CHANGED
@@ -67,6 +67,7 @@ usage_to_weights_file = {
67
  'General-Lite-2K': 'BiRefNet_lite-2K',
68
  'General-reso_512': 'BiRefNet-reso_512',
69
  'Matting': 'BiRefNet-matting',
 
70
  'Portrait': 'BiRefNet-portrait',
71
  'DIS': 'BiRefNet-DIS5K',
72
  'HRSOD': 'BiRefNet-HRSOD',
@@ -83,7 +84,7 @@ if usage in ['General-Lite-2K']:
83
  resolution = (2560, 1440)
84
  elif usage in ['General-reso_512']:
85
  resolution = (512, 512)
86
- elif usage in ['General-HR']:
87
  resolution = (2048, 2048)
88
  else:
89
  resolution = (1024, 1024)
 
67
  'General-Lite-2K': 'BiRefNet_lite-2K',
68
  'General-reso_512': 'BiRefNet-reso_512',
69
  'Matting': 'BiRefNet-matting',
70
+ 'Matting-HR': 'BiRefNet_HR-Matting',
71
  'Portrait': 'BiRefNet-portrait',
72
  'DIS': 'BiRefNet-DIS5K',
73
  'HRSOD': 'BiRefNet-HRSOD',
 
84
  resolution = (2560, 1440)
85
  elif usage in ['General-reso_512']:
86
  resolution = (512, 512)
87
+ elif usage in ['General-HR', 'Matting-HR']:
88
  resolution = (2048, 2048)
89
  else:
90
  resolution = (1024, 1024)
requirements.txt CHANGED
@@ -1,7 +1,5 @@
1
- --extra-index-url https://download.pytorch.org/whl/cu118
2
- torch==2.0.1
3
- --extra-index-url https://download.pytorch.org/whl/cu118
4
- torchvision==0.15.2
5
  numpy<2
6
  opencv-python
7
  timm
 
1
+ torch==2.5.1
2
+ torchvision
 
 
3
  numpy<2
4
  opencv-python
5
  timm