Osama-Rakan-Al-Mraikhat commited on
Commit
cfce97a
·
verified ·
1 Parent(s): a76b387

Suppress xformers impl_abstract FutureWarning at import

Browse files
Files changed (1) hide show
  1. model.py +11 -1
model.py CHANGED
@@ -1,4 +1,14 @@
1
- # From https://github.com/facebookresearch/llama/blob/main/llama/model.py
 
 
 
 
 
 
 
 
 
 
2
 
3
  import torch
4
  from torch import nn
 
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