tensorflow / ranking

Learning to Rank in TensorFlow
Apache License 2.0
2.74k stars 474 forks source link

package Bert #338

Open Tavares8 opened 1 year ago

Tavares8 commented 1 year ago

How do I pack Bert into my textual data? I have query and document pairs, should I package only documents? I ask because of this definition:

SEQ_LENGTH = 64
context_feature_spec = {}
example_feature_spec = {
    'input_word_ids': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[7] * SEQ_LENGTH),
    'input_mask': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[7] * SEQ_LENGTH),
    'input_type_ids': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[7] * SEQ_LENGTH)}
label_spec = (
    "relevance",
    tf.io.FixedLenFeature(shape=(1,), dtype=tf.int64, default_value=-1)
)

Onde context_feature_spec = { }

The antique dataset already has the keys - input_ids, input_mask, relevance e segment_ids. How do I do this for my texts?

No model de ranking there is 'feature_name_mapping' which it shows what I should deliver and what the model expects.