Spaces:
Sleeping
Sleeping
Update video_depth_anything/motion_module/attention.py
Browse files
video_depth_anything/motion_module/attention.py
CHANGED
|
@@ -17,8 +17,14 @@ import torch
|
|
| 17 |
import torch.nn.functional as F
|
| 18 |
from torch import nn
|
| 19 |
|
| 20 |
-
|
| 21 |
-
import xformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
class CrossAttention(nn.Module):
|
|
|
|
| 17 |
import torch.nn.functional as F
|
| 18 |
from torch import nn
|
| 19 |
|
| 20 |
+
try:
|
| 21 |
+
import xformers
|
| 22 |
+
import xformers.ops
|
| 23 |
+
XFORMERS_AVAILABLE = True
|
| 24 |
+
except ImportError:
|
| 25 |
+
xformers = None
|
| 26 |
+
XFORMERS_AVAILABLE = False
|
| 27 |
+
print("xFormers not available - using standard PyTorch attention")
|
| 28 |
|
| 29 |
|
| 30 |
class CrossAttention(nn.Module):
|