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

import transformers #1

Closed
Saumya1915 opened this issue Mar 23, 2021 · 13 comments
Closed

import transformers #1

Saumya1915 opened this issue Mar 23, 2021 · 13 comments

Comments

@Saumya1915
Copy link

whenever I'm writing import transformers I'm getting a error. Kindly help me with this

@kamalojasv181
Copy link
Owner

Post the error, please. Also, which version of transformer are you using?

@Saumya1915
Copy link
Author

I'm using google colab.
ModuleNotFoundError: No module named 'transformers'

@kamalojasv181
Copy link
Owner

kamalojasv181 commented Mar 23, 2021

That's because transformer module was installed on my local machine but is not installed by default on colab servers. Hence add a !pip install transformers==3.5.1 command at the beginning

@kamalojasv181
Copy link
Owner

kamalojasv181 commented Mar 23, 2021

image
It should install the module

Do the same with other modules giving the error. Make sure that you specify the versions given in the readme

@Saumya1915
Copy link
Author

image
still it is showing some error

@kamalojasv181
Copy link
Owner

Paste the complete code snippet

@Saumya1915
Copy link
Author

from sklearn import preprocessing
import pandas as pd
import numpy as np
import torch
import random
from sklearn import metrics
import transformers
import re
import emoji
import os
from torch import cuda
from sklearn.model_selection import train_test_split

This is after installing transformers

@kamalojasv181
Copy link
Owner

Where is that line where u install?

@kamalojasv181
Copy link
Owner

Please post a complete ss. Also please paste code like this

@Saumya1915
Copy link
Author

!pip install transformers==3.5.1
from data_processing import preprocessing
import pandas as pd
import numpy as np
import torch
import random
from sklearn import metrics
import transformers
import re
import emoji
import os
from torch import cuda
from sklearn.model_selection import train_test_split

@Saumya1915
Copy link
Author

image
image
image

@kamalojasv181
Copy link
Owner

@Saumya1915 there are compatibility issues with transformer 3.5.1 and torch 1.8(version installed by default in colab). Do a !pip install torch==1.5.0 in the beginning. I can verify that this works. We will definitely try to move the code to the current libraries. For now just use the versions mentioned.

@Saumya1915
Copy link
Author

Thank you for the fix!

sgoede added a commit to sgoede/NER_POS_TAG that referenced this issue Mar 30, 2021
there are compatibility issues with transformer 3.5.1 and torch 1.8(version installed by default in colab). Do a !pip install torch==1.5.0 in the beginning. 
source: kamalojasv181/Hostility-Detection-in-Hindi-Posts#1
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

2 participants