mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-05-03 16:22:06 +00:00
Lint.
This commit is contained in:
parent
10a5dfee70
commit
da5f2a82e9
@ -566,7 +566,7 @@ fn fetch_image(input: &str) -> Result<(Vec<u8>, String, usize, usize), Validatio
|
|||||||
return Err(ValidationError::InvalidImageContent(content.to_string()));
|
return Err(ValidationError::InvalidImageContent(content.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = STANDARD.decode(content["base64,".len()..].as_bytes())?;
|
let data = STANDARD.decode(&content["base64,".len()..])?;
|
||||||
let img = if let Some(format) = format_from_mimetype(mimetype) {
|
let img = if let Some(format) = format_from_mimetype(mimetype) {
|
||||||
ImageReader::with_format(Cursor::new(&data), format).decode()?
|
ImageReader::with_format(Cursor::new(&data), format).decode()?
|
||||||
} else {
|
} else {
|
||||||
@ -603,7 +603,7 @@ fn image_tokens(
|
|||||||
|
|
||||||
let mut image_string = String::with_capacity(2 * FAKE.len() + slots * IMAGE.len());
|
let mut image_string = String::with_capacity(2 * FAKE.len() + slots * IMAGE.len());
|
||||||
image_string.push_str(FAKE);
|
image_string.push_str(FAKE);
|
||||||
image_string.extend(iter::repeat(IMAGE).take(slots));
|
image_string.extend(iter::repeat_n(IMAGE, slots));
|
||||||
image_string.push_str(FAKE);
|
image_string.push_str(FAKE);
|
||||||
|
|
||||||
if matches!(
|
if matches!(
|
||||||
|
@ -350,9 +350,9 @@ class MllamaCausalLM(VlmCausalLM):
|
|||||||
cuda_graph["input_lengths"].zero_()
|
cuda_graph["input_lengths"].zero_()
|
||||||
cuda_graph["input_lengths"][: input_lengths.shape[0]] = input_lengths
|
cuda_graph["input_lengths"][: input_lengths.shape[0]] = input_lengths
|
||||||
cuda_graph["cache_lengths"].zero_()
|
cuda_graph["cache_lengths"].zero_()
|
||||||
cuda_graph["cache_lengths"][: cache_lengths_tensor.shape[0]] = (
|
cuda_graph["cache_lengths"][
|
||||||
cache_lengths_tensor
|
: cache_lengths_tensor.shape[0]
|
||||||
)
|
] = cache_lengths_tensor
|
||||||
|
|
||||||
with self._forward_context(
|
with self._forward_context(
|
||||||
block_tables=cuda_graph["block_tables"],
|
block_tables=cuda_graph["block_tables"],
|
||||||
|
Loading…
Reference in New Issue
Block a user