pandarallel icon indicating copy to clipboard operation
pandarallel copied to clipboard

free(): invalid pointer

Open MLTQ opened this issue 4 years ago • 2 comments

Running parallel_apply on a lambda function stops, then gives an error "free(): Invalid Pointer", which appears to be a C error. Screenshot from 2020-12-26 11-54-38

Also, MMM appears occasionally- see attached image.

Code to reproduce is word_vecs = raw_text.parallel_apply(lambda x: get_vecs(w2v_model, x))

where get_vecs() is:

def get_vecs(w2v_model, sentence):
yyy = []

for y in sentence.split(' '):
    try:
        yyy.append(w2v_model.wv[y])
    except:
        yyy.append(np.zeros(500))
return np.asarray(yyy).astype('float64')

and sentence is a UTF-8 string Doing this process with just a normal df.apply() works fine.

Running on Ubuntu 20.04, Python 3.8, Pandarallel 1.5.1.

MLTQ avatar Dec 26 '20 17:12 MLTQ

@MLTQ Tried using this?

word_vecs = raw_text.parallel_apply(get_vecs, w2v_model=w2v_model)

and reinitialize get_vecs to :

def get_vecs(sentence, w2v_model=None):

pratik-choudhari avatar Sep 17 '21 05:09 pratik-choudhari