Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Dec 14, 2023
1 parent cc816b8 commit 6244225
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions candle-nn/src/var_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,15 @@ impl Backend for ShardedSafeTensors {

fn get(
&self,
target_shape: Shape, // The size is not checked for ShardedTensors
target_shape: Shape, // The size is only checked when the world size is 1.
path: &str,
h: Self::Hints,
dtype: DType,
dev: &Device,
) -> Result<Tensor> {
if h == Default::default() {
// no sharding
if h.world_size == 1 {
// There is no sharding to be applied here so we use the default backend to speed
// things up.
return SimpleBackend::get(&self.0, target_shape, path, Default::default(), dtype, dev);
}

Expand Down

0 comments on commit 6244225

Please sign in to comment.