@@ -417,18 +417,16 @@ impl PipelineTokenizer {
417417
418418 /// Decode token ids back to a `String`.
419419 ///
420- /// Not implemented yet — the pipeline decode path is being built. It fails
421- /// loud (rather than returning a plausible-but-wrong string) so the oracle
422- /// test and the comparative benchmark report decode as *pending* instead of
423- /// silently validating garbage. Implementing this flips the ignored
424- /// `pipeline_decode_oracle` test on and lights up the decode charts.
425- pub fn decode ( & self , ids : & [ PipelineToken ] , _skip_special_tokens : bool ) -> Result < String > {
420+ /// Incomplete: it concatenates raw token bytes only. No decoder, no added-
421+ /// vocab lookup, no `skip_special_tokens` — so the `pipeline_decode_oracle`
422+ /// test fails on purpose until those land.
423+ pub fn decode ( & self , ids : & [ u32 ] , _skip_special_tokens : bool ) -> Result < String > {
426424 let mut output = Vec :: with_capacity ( ids. len ( ) ) ;
427- for id in ids {
425+ for & id in ids {
428426 let slice = self
429427 . model
430428 . id_to_token_bytes ( id)
431- . ok_or :: < crate :: Error > ( format ! ( "Invalid token id: {}" , id . id ) . into ( ) ) ?;
429+ . ok_or :: < crate :: Error > ( format ! ( "Invalid token id: {id}" ) . into ( ) ) ?;
432430 output. extend_from_slice ( slice) ;
433431 }
434432 Ok ( String :: from_utf8 ( output) ?)
@@ -729,7 +727,7 @@ pub trait Model {
729727
730728 fn init_scratch ( & self ) -> Self :: Scratch ;
731729
732- fn id_to_token_bytes ( & self , id : & PipelineToken ) -> Option < & [ u8 ] > ;
730+ fn id_to_token_bytes ( & self , id : u32 ) -> Option < & [ u8 ] > ;
733731}
734732
735733#[ allow(
@@ -778,7 +776,7 @@ impl Model for PipelineModel {
778776 }
779777 }
780778
781- fn id_to_token_bytes ( & self , id : & PipelineToken ) -> Option < & [ u8 ] > {
779+ fn id_to_token_bytes ( & self , id : u32 ) -> Option < & [ u8 ] > {
782780 match self {
783781 Self :: BPE ( model) => model. id_to_token_bytes ( id) ,
784782 Self :: WordLevel ( model) => model. id_to_token_bytes ( id) ,
0 commit comments