From 1e646fb41d425ac2335cc9fcced7f73f6d7507a1 Mon Sep 17 00:00:00 2001 From: Jason Sun Date: Wed, 23 Aug 2023 16:52:49 -0400 Subject: [PATCH] Compilation fix: Correct method argument types in generation.rs and validation.rs (#10) * fix: Correct method argument types in generation and validation In the `generation.rs` and `validation.rs` files, corrected the argument types passed to the `decode` method. Replaced `Vec` with `&[u32]` using the `as_ref()` method to match the expected argument types. This resolves the mismatched types compilation error during the Rust build process. Closes [#9](https://github.com/Preemo-Inc/text-generation-inference/issues/9) * Update benchmark/src/generation.rs Co-authored-by: Yang, Bo * Update router/src/validation.rs Co-authored-by: Yang, Bo --------- Co-authored-by: Yang, Bo --- benchmark/src/generation.rs | 2 +- router/src/validation.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/src/generation.rs b/benchmark/src/generation.rs index b57c652..b3e4784 100644 --- a/benchmark/src/generation.rs +++ b/benchmark/src/generation.rs @@ -218,6 +218,6 @@ fn create_sequence(sequence_length: u32, tokenizer: Tokenizer) -> String { encoding.truncate(sequence_length as usize, 0, TruncationDirection::Left); // Decode tokenizer - .decode(Vec::from(encoding.get_ids()), false) + .decode(From::from(encoding.get_ids()), false) .unwrap() } diff --git a/router/src/validation.rs b/router/src/validation.rs index be835bf..9984129 100644 --- a/router/src/validation.rs +++ b/router/src/validation.rs @@ -311,7 +311,7 @@ fn prepare_input( // truncate encoding and decode new inputs encoding.truncate(truncate, 0, TruncationDirection::Left); let inputs = tokenizer - .decode(Vec::from(encoding.get_ids()), false) + .decode(From::from(encoding.get_ids()), false) .map_err(|err| ValidationError::Tokenizer(err.to_string()))?; (inputs, encoding.len()) }