ZhengPeng7 commited on
Commit
7d10348
·
1 Parent(s): b9a7bec

Add half precision setting in README.

Browse files
Files changed (1) hide show
  1. README.md +2 -1
README.md CHANGED
@@ -112,6 +112,7 @@ birefnet = ... # -- BiRefNet should be loaded with codes above, either way.
112
  torch.set_float32_matmul_precision(['high', 'highest'][0])
113
  birefnet.to('cuda')
114
  birefnet.eval()
 
115
 
116
  def extract_object(birefnet, imagepath):
117
  # Data settings
@@ -123,7 +124,7 @@ def extract_object(birefnet, imagepath):
123
  ])
124
 
125
  image = Image.open(imagepath)
126
- input_images = transform_image(image).unsqueeze(0).to('cuda')
127
 
128
  # Prediction
129
  with torch.no_grad():
 
112
  torch.set_float32_matmul_precision(['high', 'highest'][0])
113
  birefnet.to('cuda')
114
  birefnet.eval()
115
+ birefnet.half()
116
 
117
  def extract_object(birefnet, imagepath):
118
  # Data settings
 
124
  ])
125
 
126
  image = Image.open(imagepath)
127
+ input_images = transform_image(image).unsqueeze(0).to('cuda').half()
128
 
129
  # Prediction
130
  with torch.no_grad():