ZhengPeng7 commited on
Commit
b521789
·
1 Parent(s): cbc80cf

Add local_dir_use_symlinks=False in from_pretrained.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -98,7 +98,7 @@ usage_to_weights_file = {
98
  'General-dynamic': 'BiRefNet_dynamic',
99
  }
100
 
101
- birefnet = transformers.AutoModelForImageSegmentation.from_pretrained('/'.join(('zhengpeng7', usage_to_weights_file['General'])), trust_remote_code=True, cache_dir=hf_cache_path)
102
  birefnet.to(device)
103
  birefnet.eval(); birefnet.half()
104
 
@@ -111,7 +111,7 @@ def predict(images, resolution, weights_file):
111
  # Load BiRefNet with chosen weights
112
  _weights_file = '/'.join(('zhengpeng7', usage_to_weights_file[weights_file] if weights_file is not None else usage_to_weights_file['General']))
113
  print('Using weights: {}.'.format(_weights_file))
114
- birefnet = transformers.AutoModelForImageSegmentation.from_pretrained(_weights_file, trust_remote_code=True, cache_dir=hf_cache_path)
115
  birefnet.to(device)
116
  birefnet.eval(); birefnet.half()
117
 
 
98
  'General-dynamic': 'BiRefNet_dynamic',
99
  }
100
 
101
+ birefnet = transformers.AutoModelForImageSegmentation.from_pretrained('/'.join(('zhengpeng7', usage_to_weights_file['General'])), trust_remote_code=True, cache_dir=hf_cache_path, local_dir_use_symlinks=False)
102
  birefnet.to(device)
103
  birefnet.eval(); birefnet.half()
104
 
 
111
  # Load BiRefNet with chosen weights
112
  _weights_file = '/'.join(('zhengpeng7', usage_to_weights_file[weights_file] if weights_file is not None else usage_to_weights_file['General']))
113
  print('Using weights: {}.'.format(_weights_file))
114
+ birefnet = transformers.AutoModelForImageSegmentation.from_pretrained(_weights_file, trust_remote_code=True, cache_dir=hf_cache_path, local_dir_use_symlinks=False)
115
  birefnet.to(device)
116
  birefnet.eval(); birefnet.half()
117