google / active-qa

Apache License 2.0
346 stars 65 forks source link

Nonsensical reformed queries from Reformulator #16

Closed kaustumbh7 closed 5 years ago

kaustumbh7 commented 5 years ago

I am trying to get the reformulations from the reformulator but I get all nonsensical reformulations like this-

image

My questions were- ['how can i apply for nsa?', 'what is the minimum working hours required for a day?']

I used this code to get the reformulations-

from px.nmt import reformulator
from px.proto import reformulator_pb2

questions = ['how can i apply for nsa?', 'what is the minimum working hours required for a day?']

reformulator_instance = reformulator.Reformulator(
    hparams_path='px/nmt/example_configs/reformulator.json',
    source_prefix='<en> <2en> ',
    out_dir='path/to/reformulator_dir',
    environment_server_address='localhost:10000')

# Change from GREEDY to BEAM if you want 20 rewrites instead of one.
responses = reformulator_instance.reformulate(
    questions=questions,
    inference_mode=reformulator_pb2.ReformulatorRequest.GREEDY)

# Since we are using greedy decoder, keep only the first rewrite.
reformulations = [r[0].reformulation for r in responses]

print reformulations
kaustumbh7 commented 5 years ago

Resolved ✅ Tensorflow version 1.12.2 is required and if there is tensorflow-estimator installed it needs to be uninstalled. Suggested by- @graviraja