@@ -22,8 +22,8 @@ impl LlamaContext<'_> {
2222 ///
2323 /// * `src` - The sequence id to copy the cache from.
2424 /// * `dest` - The sequence id to copy the cache to.
25- /// * `p0` - The start position of the cache to clear. If `None`, the entire cache is copied up to [p1] .
26- /// * `p1` - The end position of the cache to clear. If `None`, the entire cache is copied starting from [p0] .
25+ /// * `p0` - The start position of the cache to clear. If `None`, the entire cache is copied up to `p1` .
26+ /// * `p1` - The end position of the cache to clear. If `None`, the entire cache is copied starting from `p0` .
2727 pub fn copy_kv_cache_seq ( & mut self , src : i32 , dest : i32 , p0 : Option < u16 > , p1 : Option < u16 > ) {
2828 let p0 = p0. map_or ( -1 , i32:: from) ;
2929 let p1 = p1. map_or ( -1 , i32:: from) ;
@@ -37,8 +37,8 @@ impl LlamaContext<'_> {
3737 /// # Parameters
3838 ///
3939 /// * `src` - The sequence id to clear the cache for.
40- /// * `p0` - The start position of the cache to clear. If `None`, the entire cache is cleared up to [p1] .
41- /// * `p1` - The end position of the cache to clear. If `None`, the entire cache is cleared from [p0] .
40+ /// * `p0` - The start position of the cache to clear. If `None`, the entire cache is cleared up to `p1` .
41+ /// * `p1` - The end position of the cache to clear. If `None`, the entire cache is cleared from `p0` .
4242 pub fn clear_kv_cache_seq ( & mut self , src : i32 , p0 : Option < u16 > , p1 : Option < u16 > ) {
4343 let p0 = p0. map_or ( -1 , i32:: from) ;
4444 let p1 = p1. map_or ( -1 , i32:: from) ;
@@ -68,16 +68,16 @@ impl LlamaContext<'_> {
6868 }
6969
7070 #[ allow( clippy:: doc_markdown) ]
71- /// Adds relative position "delta" to all tokens that belong to the specified sequence and have positions in [p0, p1)
71+ /// Adds relative position "delta" to all tokens that belong to the specified sequence and have positions in ` [p0, p1)`
7272 /// If the KV cache is RoPEd, the KV data is updated accordingly:
7373 /// - lazily on next [`LlamaContext::decode`]
7474 /// - explicitly with [`Self::kv_cache_update`]
7575 ///
7676 /// # Parameters
7777 ///
7878 /// * `seq_id` - The sequence id to update
79- /// * `p0` - The start position of the cache to update. If `None`, the entire cache is updated up to [p1] .
80- /// * `p1` - The end position of the cache to update. If `None`, the entire cache is updated starting from [p0] .
79+ /// * `p0` - The start position of the cache to update. If `None`, the entire cache is updated up to `p1` .
80+ /// * `p1` - The end position of the cache to update. If `None`, the entire cache is updated starting from `p0` .
8181 /// * `delta` - The relative position to add to the tokens
8282 pub fn kv_cache_seq_add ( & mut self , seq_id : i32 , p0 : Option < u16 > , p1 : Option < u16 > , delta : i32 ) {
8383 let p0 = p0. map_or ( -1 , i32:: from) ;
@@ -95,8 +95,8 @@ impl LlamaContext<'_> {
9595 /// # Parameters
9696 ///
9797 /// * `seq_id` - The sequence id to update
98- /// * `p0` - The start position of the cache to update. If `None`, the entire cache is updated up to [p1] .
99- /// * `p1` - The end position of the cache to update. If `None`, the entire cache is updated starting from [p0] .
98+ /// * `p0` - The start position of the cache to update. If `None`, the entire cache is updated up to `p1` .
99+ /// * `p1` - The end position of the cache to update. If `None`, the entire cache is updated starting from `p0` .
100100 /// * `d` - The factor to divide the positions by
101101 pub fn kv_cache_seq_div (
102102 & mut self ,
@@ -238,11 +238,11 @@ impl<'a> KVCacheView<'a> {
238238 unsafe {
239239 std:: slice:: from_raw_parts (
240240 self . view . cells_sequences ,
241- usize:: try_from ( self . view . n_cells * self . view . n_max_seq )
241+ usize:: try_from ( self . view . n_cells * self . view . n_seq_max )
242242 . expect ( "failed to fit n_cells * n_max_seq into usize" ) ,
243243 )
244244 }
245- . chunks ( usize:: try_from ( self . view . n_max_seq ) . expect ( "failed to fit n_max_seq into usize" ) )
245+ . chunks ( usize:: try_from ( self . view . n_seq_max ) . expect ( "failed to fit n_max_seq into usize" ) )
246246 }
247247}
248248
0 commit comments