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

Error with numpy dependencies #138

Open
1 of 11 tasks
LilAntonioC opened this issue May 21, 2024 · 0 comments
Open
1 of 11 tasks

Error with numpy dependencies #138

LilAntonioC opened this issue May 21, 2024 · 0 comments

Comments

@LilAntonioC
Copy link

Information

The problem arises in chapter:

  • Introduction
  • Text Classification
  • Transformer Anatomy
  • Multilingual Named Entity Recognition
  • Text Generation
  • Summarization
  • Question Answering
  • Making Transformers Efficient in Production
  • Dealing with Few to No Labels
  • Training Transformers from Scratch
  • Future Directions

Describe the bug

After trying to run it fails
`def extract_hidden_states(batch):
# Place model inputs on the GPU
inputs = {k:v.to(device) for k,v in batch.items()
if k in tokenizer.model_input_names}
# Extract last hidden states
with torch.no_grad():
last_hidden_state = model(**inputs).last_hidden_state
# Return vector for [CLS] token
return {"hidden_state": last_hidden_state[:,0].cpu().numpy()}

emotions_hidden = emotions_encoded.map(extract_hidden_states, batched=True)
`
I tried on my machine and also on colab, and both seem to have the same error, I tried to modified the setup, but for some reason I cannot change the numpy library to an older version, I don't know someone has the same error

To Reproduce

Steps to reproduce the behavior:

  1. Run the cell emotions_hidden = emotions_encoded.map(extract_hidden_states, batched=True)

the error 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:

Expected behavior

Run the cell as expected an preprocess all the dataset

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