Skip to content

Commit

Permalink
style: fmt and fix for clippy
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Dec 30, 2024
1 parent 9175622 commit 2580e6b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions causal-lm/src/query_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct QueryContext<'a, Storage> {
pub range: Range<upos>,
}

impl<'a, Storage> QueryContext<'a, Storage> {
impl<Storage> QueryContext<'_, Storage> {
/// 查询的位置。
#[inline]
pub const fn pos(&self) -> upos {
Expand All @@ -33,7 +33,7 @@ type KVCache<'a, T> = (
Tensor<LocalSplitable<&'a mut [T]>>,
);

impl<'a, Storage, T> QueryContext<'a, Storage>
impl<Storage, T> QueryContext<'_, Storage>
where
Storage: DerefMut<Target = [T]>,
{
Expand Down
7 changes: 5 additions & 2 deletions models/llama/common-cpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ impl ComputeStream for Transformer {

struct LlamaLayer<'a>(&'a LayerStorage<Weight>);

impl<'a> llama::LLamaLayer for LlamaLayer<'a> {
impl llama::LLamaLayer for LlamaLayer<'_> {
type Byte = u8;
type Storage<'m> = Weight where Self: 'm;
type Storage<'m>
= Weight
where
Self: 'm;

#[inline]
fn att_layernorm(&self) -> Tensor<Self::Storage<'_>> {
Expand Down
7 changes: 5 additions & 2 deletions models/llama/nvidia-gpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,12 @@ macro_rules! access {
.map_physical(|u| &**u.sprout_ref($self.transfer.ctx()))
};
}
impl<'a> llama::LLamaLayer for LayerLoader<'a> {
impl llama::LLamaLayer for LayerLoader<'_> {
type Byte = DevByte;
type Storage<'m> = &'m[DevByte] where Self: 'm;
type Storage<'m>
= &'m [DevByte]
where
Self: 'm;

fn att_layernorm(&self) -> Tensor<Self::Storage<'_>> {
access!(self, att_layernorm)
Expand Down
4 changes: 2 additions & 2 deletions tensor/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SliceDim {
step: self.step,
len: {
let step = self.step as udim;
((len - self.start + step - 1) / step).min(self.len)
(len - self.start).div_ceil(step).min(self.len)
},
}
}
Expand All @@ -93,7 +93,7 @@ impl SliceDim {
step: self.step,
len: {
let step = self.step.unsigned_abs();
((start + 1 + step - 1) / step).min(self.len)
(start + 1).div_ceil(step).min(self.len)
},
}
}
Expand Down

0 comments on commit 2580e6b

Please sign in to comment.