MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / decode

Method decode

src/tokenizer.rs:197–202  ·  view source on GitHub ↗
(&self, tokens: &[u32])

Source from the content-addressed store, hash-verified

195 }
196
197 pub fn decode(&self, tokens: &[u32]) -> String {
198 let text: String = tokens.iter().map(|t| self.decoder[t].as_str()).collect();
199 let decoded_bytes: Vec<u8> = text.chars().map(|c| self.byte_decoder[&c]).collect();
200
201 String::from_utf8_lossy(&decoded_bytes[..]).replace("</w>", " ")
202 }
203}
204
205#[cfg(test)]

Callers 1

test_encode_decodeFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_encode_decodeFunction · 0.36