Skip to content

Commit

Permalink
Speedup ShardedSafeTensors to load Tensors with default hints
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyish committed Nov 28, 2023
1 parent 7c3cfd1 commit cc816b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion candle-nn/src/var_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,17 @@ impl Backend for ShardedSafeTensors {

fn get(
&self,
_target_shape: Shape, // The size is not checked for ShardedTensors
target_shape: Shape, // The size is not checked for ShardedTensors
path: &str,
h: Self::Hints,
dtype: DType,
dev: &Device,
) -> Result<Tensor> {
if h == Default::default() {
// no sharding
return SimpleBackend::get(&self.0, target_shape, path, Default::default(), dtype, dev);
}

let Shard {
dim,
rank,
Expand Down

0 comments on commit cc816b8

Please sign in to comment.