Osama-Rakan-Al-Mraikhat commited on
Commit
b8f95d9
·
verified ·
1 Parent(s): 51186f3

Suppress xformers impl_abstract FutureWarning at import

Browse files
Files changed (1) hide show
  1. model.py +12 -0
model.py CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  import torch
2
  from torch import nn
3
 
 
1
+ import warnings
2
+
3
+ # xformers 0.0.27 still calls `torch.library.impl_abstract`, which torch
4
+ # deprecated in favor of `register_fake`. Suppress the FutureWarning before
5
+ # importing xformers so anyone doing `AutoModel.from_pretrained(...)` gets
6
+ # clean output. xformers 0.0.28+ fixed it; this filter is a no-op there.
7
+ warnings.filterwarnings(
8
+ "ignore",
9
+ message=r"`torch\.library\.impl_abstract` was renamed.*",
10
+ category=FutureWarning,
11
+ )
12
+
13
  import torch
14
  from torch import nn
15