backend.rs 865 Bytes
Newer Older
Biswa Panda's avatar
Biswa Panda committed
1
2
3
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

Neelay Shah's avatar
Neelay Shah committed
4
use dynamo_llm::backend::Backend;
5
use dynamo_llm::model_card::ModelDeploymentCard;
Biswa Panda's avatar
Biswa Panda committed
6

7
8
#[test]
fn test_sequence_factory() {
9
10
    let mdc = ModelDeploymentCard::load_from_disk("tests/data/sample-models/TinyLlama_v1.1", None)
        .unwrap();
Biswa Panda's avatar
Biswa Panda committed
11

12
    let operator = Backend::from_mdc(&mdc);
Biswa Panda's avatar
Biswa Panda committed
13

14
15
16
17
18
    let mut decode_stream = operator
        .tokenizer
        .as_ref()
        .unwrap()
        .decode_stream(&[], false);
Biswa Panda's avatar
Biswa Panda committed
19
20
21
    let output = decode_stream.step(1).unwrap();
    assert_eq!(output, Some("<s>".to_string()));

22
23
24
25
26
    let mut decode_stream = operator
        .tokenizer
        .as_ref()
        .unwrap()
        .decode_stream(&[], true);
Biswa Panda's avatar
Biswa Panda committed
27
28
29
    let output = decode_stream.step(1).unwrap();
    assert_eq!(output, None);
}