Xpu(usize),
Xla(usize),
Mlu(usize),
- Hpu,
+ Hpu(usize),
/// User didn't specify accelerator, torch
/// is responsible for choosing.
Anonymous(usize),
"xpu" => Ok(Device::Xpu(0)),
"xla" => Ok(Device::Xla(0)),
"mlu" => Ok(Device::Mlu(0)),
- "hpu" => Ok(Device::Hpu),
+ "hpu" => Ok(Device::Hpu(0)),
name if name.starts_with("cuda:") => parse_device(name).map(Device::Cuda),
name if name.starts_with("npu:") => parse_device(name).map(Device::Npu),
name if name.starts_with("xpu:") => parse_device(name).map(Device::Xpu),
name if name.starts_with("xla:") => parse_device(name).map(Device::Xla),
name if name.starts_with("mlu:") => parse_device(name).map(Device::Mlu),
+ name if name.starts_with("hpu:") => parse_device(name).map(Device::Hpu),
name => Err(SafetensorError::new_err(format!(
"device {name} is invalid"
))),
Device::Xpu(n) => format!("xpu:{n}").into_pyobject(py).map(|x| x.into_any()),
Device::Xla(n) => format!("xla:{n}").into_pyobject(py).map(|x| x.into_any()),
Device::Mlu(n) => format!("mlu:{n}").into_pyobject(py).map(|x| x.into_any()),
- Device::Hpu => "hpu".into_pyobject(py).map(|x| x.into_any()),
+ Device::Hpu(n) => format!("hpu:{n}").into_pyobject(py).map(|x| x.into_any()),
Device::Anonymous(n) => n.into_pyobject(py).map(|x| x.into_any()),
}
}