Giter Club home page Giter Club logo

Comments (1)

Gopichand995 avatar Gopichand995 commented on July 18, 2024

I am currently using "transformers" with a version of 4.26.0...i would like to know how to rectify the following module issue...here is the code

import pandas as pd
from ast import literal_eval

from cdqa.utils.filters import filter_paragraphs
from cdqa.utils.download import download_model, download_bnpp_data
from cdqa.pipeline.cdqa_sklearn import QAPipeline

Download data and models

download_bnpp_data(dir=r'C:\Users\04647U744\Desktop\exp')
download_model(model='bert-squad_1.1', dir=r'C:\Users\04647U744\Desktop\exp')

Loading data and filtering / preprocessing the documents

df = pd.read_csv(r'C:\Users\04647U744\Documents\Github\CASH_sfaidebtreducer_WSP\data\paragraphs.csv',
converters={'paragraphs': literal_eval})
df = filter_paragraphs(df)

Loading QAPipeline with CPU version of BERT Reader pretrained on SQuAD 1.1

cdqa_pipeline = QAPipeline(reader=r'C:\Users\04647U744\Desktop\exp\bert_qa.joblib')

Fitting the retriever to the list of documents in the dataframe

cdqa_pipeline.fit_retriever(df)

Sending a question to the pipeline and getting prediction

query = 'what is round robin assignment rule?'
prediction = cdqa_pipeline.predict(query)

print('query: {}\n'.format(query))
print('answer: {}\n'.format(prediction[0]))
print('title: {}\n'.format(prediction[1]))
print('paragraph: {}\n'.format(prediction[2]))

from cdqa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.