aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/derived/globalphase_token_functions/test.sd
blob: a1d14258aabe06d899d8cd33cf20744eec15d683 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

schema test {
    document test {
        field title type string {
            indexing: index | summary
        }
        field tokens type tensor(d0[128]) {
            indexing: attribute
        }
        field outputidx type double {
            indexing: attribute
        }
    }
    fieldset default {
        fields: title
    }

    onnx-model my_ranking_model {
        file: files/ranking_model.onnx
        input input_ids: input_ids
        input attention_mask: attention_mask
        input token_type_ids: token_type_ids
    }

    rank-profile using_model {
        inputs {
            query(input) tensor(d0[32])
        }
        function input_ids() {
            expression: tokenInputIds(128, query(input), attribute(tokens))
        }
        function token_type_ids() {
            expression: tokenTypeIds(128, query(input), attribute(tokens))
        }
        function attention_mask() {
            expression: tokenAttentionMask(128, query(input), attribute(tokens))
        }
        global-phase {
            rerank-count: 1000
            expression: onnx(my_ranking_model).score{d0:attribute(outputidx)}
        }
    }

}