Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryError workaround #357

Open
nortz8 opened this issue Mar 29, 2020 · 1 comment
Open

MemoryError workaround #357

nortz8 opened this issue Mar 29, 2020 · 1 comment

Comments

@nortz8
Copy link

nortz8 commented Mar 29, 2020

Kindly consider changing the def _expand_paragraphs function in the cdqa_sklearn.py file to accommodate larger datasets. Modifying the dataframe needs a lot of memory for bigger data so it would be better to set it as a list of dict before making it a dataframe.

Below is the modification I did so I would not get a MemoryError:

@staticmethod
def _expand_paragraphs(df): 
     data=[]
     for n in range(len(df)):  
         stringlist = df.iloc[n][1]  
         for m in range(len(stringlist)): 
             a=df.iloc[n][0] 
             b=stringlist[m] 
             data.append({'title' : a, 'content' : b}) 
     dfx = pd.DataFrame(data) 
     return dfx
@adjouama
Copy link

Very good point. +1 @nortz8
However, your workaround did not work for me. I ended up having the following;
ValueError: empty vocabulary; perhaps the documents only contain stop words

Any idea why ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants