blob: 511e09948b420c306565a1751ccd7f1d40d4b221 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Copyright Vespa.ai. 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)}
}
}
rank-profile with-fun {
function use_model() {
expression: attribute(outputidx) + 1.0
}
global-phase {
expression: use_model
}
}
rank-profile with-fun-mf inherits with-fun {
first-phase {
expression: nativeRank
}
match-features: use_model
}
rank-profile fun-mf-child inherits with-fun-mf {
first-phase {
expression: 42 * attribute(outputidx)
}
}
}
|