diff options
author | Nicolas Patry <patry.nicolas@protonmail.com> | 2023-08-02 19:18:43 +0200 |
---|---|---|
committer | Nicolas Patry <patry.nicolas@protonmail.com> | 2023-08-02 19:18:43 +0200 |
commit | dba31473d40c88fed22574ba96021dc59f25f3f7 (patch) | |
tree | 5ce0c87397bd15678f7d5df4a6a9c4ab581fde99 /candle-examples/src | |
parent | 1b2b32e58d13ac96cee42562b845fcecfd3a08de (diff) | |
download | candle-dba31473d40c88fed22574ba96021dc59f25f3f7.tar.gz candle-dba31473d40c88fed22574ba96021dc59f25f3f7.tar.bz2 candle-dba31473d40c88fed22574ba96021dc59f25f3f7.zip |
Typos and format and CD only when PR lands.
Diffstat (limited to 'candle-examples/src')
-rw-r--r-- | candle-examples/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/candle-examples/src/lib.rs b/candle-examples/src/lib.rs index 3410026e..2b6009b4 100644 --- a/candle-examples/src/lib.rs +++ b/candle-examples/src/lib.rs @@ -73,8 +73,8 @@ let mmap = unsafe { Mmap::map(&file).unwrap() }; // Use safetensors directly let tensors = SafeTensors::deserialize(&mmap[..]).unwrap(); let view = tensors -.tensor("bert.encoder.layer.0.attention.self.query.weight") -.unwrap(); + .tensor("bert.encoder.layer.0.attention.self.query.weight") + .unwrap(); // We're going to load shard with rank 1, within a world_size of 4 // We're going to split along dimension 0 doing VIEW[start..stop, :] @@ -86,7 +86,7 @@ let mut tp_shape = view.shape().to_vec(); let size = tp_shape[0]; if size % world_size != 0 { -panic!("The dimension is not divisble by `world_size`"); + panic!("The dimension is not divisble by `world_size`"); } let block_size = size / world_size; let start = rank * block_size; @@ -102,7 +102,7 @@ tp_shape[dim] = block_size; // Convert safetensors Dtype to candle DType let dtype: DType = dtype.try_into().unwrap(); -// TODO: Implement from_buffer_iterator to we can skip the extra CPU alloc. +// TODO: Implement from_buffer_iterator so we can skip the extra CPU alloc. let raw: Vec<u8> = iterator.into_iter().flatten().cloned().collect(); let tp_tensor = Tensor::from_raw_buffer(&raw, dtype, &tp_shape, &Device::Cpu).unwrap(); // ANCHOR_END: book_hub_3 |