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

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

Open
trinayanbharadwaj opened this issue Mar 1, 2022 · 0 comments

Comments

@trinayanbharadwaj
Copy link

trinayanbharadwaj commented Mar 1, 2022

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'

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

1 participant