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<u32>` 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 <pop.atry@gmail.com>

* Update router/src/validation.rs

Co-authored-by: Yang, Bo <pop.atry@gmail.com>

---------

Co-authored-by: Yang, Bo <pop.atry@gmail.com>
This commit is contained in:
Jason Sun 2023-08-23 16:52:49 -04:00 committed by GitHub
parent d2ae3581bf
commit 1e646fb41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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()
}

View File

@ -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())
}