Open fin-amal-joseph opened 4 years ago
I experience the same problem when I load my new dataset. Is this fix?
You have to fit the pipeline retriever to the dataframe with the documents before calling the predict()
function:
cdqa_pipeline.fit_retriever(df=df)
I had a similar problem because I thought cdqa_pipeline.dump_reader()
would dump the trained retriever too.
from cdqa.pipeline import QAPipeline
cdqa_pipeline = QAPipeline(reader='./models/distilbert_qa.joblib')
cdqa_pipeline.fit_retriever(df=df)
cdqa_pipeline.dump_reader('./models/distilbert_qa_fine_tuned.joblib')
from cdqa.pipeline import QAPipeline
cdqa_pipeline = QAPipeline(reader='./models/distilbert_qa_fine_tuned.joblib')
cdqa_pipeline.fit_retriever(df=df)
# fix:
# cdqa_pipeline = QAPipeline(reader='./models/distilbert_qa.joblib')
# cdqa_pipeline = cdqa_pipeline.fit_retriever(df=df)
while True:
q = input('Question: ')
answer = cdqa_pipeline.predict(query=q)
print(answer)
I 've got an issue when predicting adding sample code and error below
cdqa_pipeline = QAPipeline(reader='bert_models/bert_qa.joblib') cdqa_pipeline.fit_reader('bert_models/SQuAD_1.1/train-v1.1.json') cdqa_pipeline = QAPipeline(reader='bert_out.joblib') cdqa_pipeline.predict(query="Who is chaplin?")
NotFittedError Traceback (most recent call last)