示例#1
0
Results on unseen test set (run with flag
`-t wizard_of_wikipedia:WizardDialogKnowledge:topic_split`):
Hits@1/100: 68.96
"""

if __name__ == '__main__':
    parser = ParlaiParser(add_model_args=True)
    parser.add_argument('-n', '--num-examples', default=100000000)
    parser.add_argument('-d', '--display-examples', type='bool', default=False)
    parser.add_argument('-ltim', '--log-every-n-secs', type=float, default=2)
    WizardTransformerRankerAgent.add_cmdline_args(parser, partial_opt=None)
    parser.set_params(
        task='wizard_of_wikipedia',
        model='projects:wizard_of_wikipedia:wizard_transformer_ranker',
        model_file=
        'models:wizard_of_wikipedia/full_dialogue_retrieval_model/model',
        datatype='test',
        n_heads=6,
        ffn_size=1200,
        embeddings_scale=False,
        delimiter=' __SOC__ ',
        n_positions=1000,
        legacy=True,
    )

    opt = parser.parse_args()
    download(opt['datapath'])  # download pretrained retrieval model

    eval_model(opt)
#!/usr/bin/env python

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Interact with a pre-trained retrieval model.
"""
from parlai.scripts.interactive import setup_args, interactive
from parlai.zoo.wizard_of_wikipedia.full_dialogue_retrieval_model import download

if __name__ == '__main__':
    parser = setup_args()
    parser.set_params(
        model='projects:wizard_of_wikipedia:interactive_retrieval',
        retriever_model_file='models:wikipedia_full/tfidf_retriever/model',
        responder_model_file='models:wizard_of_wikipedia/'
        'full_dialogue_retrieval_model/model',
    )
    opt = parser.parse_args(print_args=False)
    download(opt['datapath'])
    interactive(opt, print_parser=parser)