update readme and fmt
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ pub fn get_device(device: Option<&Device>) -> Device {
|
||||
None => {
|
||||
#[cfg(feature = "cuda")]
|
||||
{
|
||||
Device::new_cuda(6).unwrap_or(Device::Cpu)
|
||||
Device::new_cuda(0).unwrap_or(Device::Cpu)
|
||||
}
|
||||
#[cfg(not(feature = "cuda"))]
|
||||
{
|
||||
|
||||
@@ -15,7 +15,10 @@ pub fn prepare_causal_attention_mask(
|
||||
let arange = Tensor::arange(0u32, tgt_len as u32, device)?;
|
||||
let arange = arange.unsqueeze(1)?.broadcast_as((tgt_len, tgt_len))?;
|
||||
let upper_triangle = arange.t()?.gt(&arange)?;
|
||||
let mask = upper_triangle.where_cond(&Tensor::new(f32::NEG_INFINITY, device)?.broadcast_as(arange.shape())?, &Tensor::new(0f32, device)?.broadcast_as(arange.shape())?)?;
|
||||
let mask = upper_triangle.where_cond(
|
||||
&Tensor::new(f32::NEG_INFINITY, device)?.broadcast_as(arange.shape())?,
|
||||
&Tensor::new(0f32, device)?.broadcast_as(arange.shape())?,
|
||||
)?;
|
||||
|
||||
let mask = if seqlen_offset > 0 {
|
||||
let mask0 = Tensor::zeros((tgt_len, seqlen_offset), DType::F32, device)?;
|
||||
|
||||
Reference in New Issue
Block a user