For the compatibility with the latest transformers lib.
Browse files- birefnet.py +5 -0
    	
        birefnet.py
    CHANGED
    
    | @@ -7,6 +7,11 @@ from transformers import PretrainedConfig | |
| 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
         | 
| 12 |  | 
|  | |
| 7 |  | 
| 8 | 
             
            class Config(PretrainedConfig):
         | 
| 9 | 
             
                def __init__(self) -> None:
         | 
| 10 | 
            +
                    # Compatible with the latest version of transformers.
         | 
| 11 | 
            +
                    # Error source: https://github.com/huggingface/transformers/commit/9568b506ed511c76ab4d0c6ed591c7fce8e048a5
         | 
| 12 | 
            +
                    # Previous solution in the users' end: https://github.com/ZhengPeng7/BiRefNet/issues/189#issuecomment-2716688688
         | 
| 13 | 
            +
                    super().__init__()
         | 
| 14 | 
            +
             | 
| 15 | 
             
                    # PATH settings
         | 
| 16 | 
             
                    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
         | 
| 17 |  | 
