add metal support
This commit is contained in:
@@ -36,6 +36,7 @@ rayon = "1.10"
|
|||||||
[features]
|
[features]
|
||||||
flash-attn=["candle-flash-attn"]
|
flash-attn=["candle-flash-attn"]
|
||||||
cuda=["candle-nn/cuda", "candle-core/cuda", "candle-transformers/cuda"]
|
cuda=["candle-nn/cuda", "candle-core/cuda", "candle-transformers/cuda"]
|
||||||
|
metal=["candle-nn/metal", "candle-core/metal", "candle-transformers/metal"]
|
||||||
ffmpeg=["ffmpeg-next"]
|
ffmpeg=["ffmpeg-next"]
|
||||||
|
|
||||||
[lints.clippy]
|
[lints.clippy]
|
||||||
|
|||||||
+5
-1
@@ -27,7 +27,11 @@ pub fn get_device(device: Option<&Device>) -> Device {
|
|||||||
{
|
{
|
||||||
Device::new_cuda(0).unwrap_or(Device::Cpu)
|
Device::new_cuda(0).unwrap_or(Device::Cpu)
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "cuda"))]
|
#[cfg(all(not(feature = "cuda"), feature = "metal"))]
|
||||||
|
{
|
||||||
|
Device::new_metal(0).unwrap_or(Device::Cpu)
|
||||||
|
}
|
||||||
|
#[cfg(all(not(feature = "cuda"), not(feature = "metal")))]
|
||||||
{
|
{
|
||||||
Device::Cpu
|
Device::Cpu
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user