File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 3434if torch .cuda .is_available ():
3535 from .backends .cuda import ops as cuda_ops
3636
37- if torch .xpu .is_available ():
37+ if hasattr ( torch , "xpu" ) and torch .xpu .is_available ():
3838 from .backends .xpu import ops as xpu_ops
3939
4040
Original file line number Diff line number Diff line change 3030 1.0 ,
3131 ],
3232 dtype = torch .float32 ,
33- device = "xpu" if torch .xpu .is_available () else "cpu" , # Only cpu/xpu use this table for now.
33+ device = "xpu"
34+ if hasattr (torch , "xpu" ) and torch .xpu .is_available ()
35+ else "cpu" , # Only cpu/xpu use this table for now.
3436)
3537_FP4_QUANT_TABLE = torch .tensor (
3638 [
5254 - 0.2500 ,
5355 ],
5456 dtype = torch .float32 ,
55- device = "xpu" if torch .xpu .is_available () else "cpu" , # Only cpu/xpu use this table for now.
57+ device = "xpu"
58+ if hasattr (torch , "xpu" ) and torch .xpu .is_available ()
59+ else "cpu" , # Only cpu/xpu use this table for now.
5660)
5761CODE = {"nf4" : _NF4_QUANT_TABLE , "fp4" : _FP4_QUANT_TABLE }
You can’t perform that action at this time.
0 commit comments