nlp-with-transformers / notebooks

Jupyter notebooks for the Natural Language Processing with Transformers book
https://transformersbook.com/
Apache License 2.0
3.85k stars 1.19k forks source link

AttributeError: module 'numpy' has no attribute 'object'. #130

Open turgutguvenc opened 9 months ago

turgutguvenc commented 9 months ago

Information

The problem arises in chapter:

Describe the bug

When I run this code below I get this error: AttributeError: module 'numpy' has no attribute 'object'. probably map function or dataset library has deprecated version of numpy use use np.object. emotions_hidden = emotions_encoded.map(extract_hidden_states, batched=True)

To Reproduce

Steps to reproduce the behavior:

  1. I am getting this error when I run this code: emotions_hidden = emotions_encoded.map(extract_hidden_states, batched=True)

AttributeError Traceback (most recent call last) Cell In[86], line 1 ----> 1 emotions_hidden = emotions_encoded.map(extract_hidden_states, batched=True)

AttributeError: module 'numpy' has no attribute 'object'. np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations add Codeadd Markdown

Expected behavior

PhocaHiro commented 8 months ago

I used "monkey patch" like below.

import numpy as np np.object = object