Skip to content

ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long' #62

Description

@trinayanbharadwaj

While following the model training guide, ran into this error.

ValueError                                Traceback (most recent call last)
Input In [10], in <cell line: 1>()
----> 1 clf = trunk.train_sp(X, y, n_iter=5, verbose=2)

File ~\indic-trans\indictrans\trunk\__init__.py:69, in train_sp(X, y, n_iter, lr_exp, random_state, verbose)
     65 def train_sp(X, y, n_iter=10, lr_exp=0.1,
     66              random_state=37, verbose=0):
     67     clf = StructuredPerceptron(random_state=random_state,
     68                                n_iter=n_iter, verbose=verbose)
---> 69     clf.fit(X, y)
     70     return clf

File ~\indic-trans\indictrans\trunk\perceptron.py:149, in StructuredPerceptron.fit(self, X, y)
    146 Y_diff *= -lr
    147 w_update = Y_diff.T * X_i
--> 149 t_trans = count_tranxn(y_t_i, n_classes)
    150 p_trans = count_tranxn(y_pred, n_classes)
    151 b_trans_update = lr * (p_trans - t_trans)

File ~\indic-trans\indictrans\_utils\ctranxn.pyx:7, in indictrans._utils.ctranxn.count_tranxn()
      5 np.import_array()
      6 
----> 7 @cython.boundscheck(False)
      8 @cython.wraparound(False)
      9 def count_tranxn(np.ndarray[ndim=1, dtype=np.npy_intp] y, n_classes):

ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions