kamalojasv181 / Hostility-Detection-in-Hindi-Posts

6 stars 1 forks source link

import transformers #1

Closed Saumya1915 closed 3 years ago

Saumya1915 commented 3 years ago

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

kamalojasv181 commented 3 years ago

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

Saumya1915 commented 3 years ago

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

kamalojasv181 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

image still it is showing some error

kamalojasv181 commented 3 years ago

Paste the complete code snippet

Saumya1915 commented 3 years ago

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 commented 3 years ago

Where is that line where u install?

kamalojasv181 commented 3 years ago

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

Saumya1915 commented 3 years ago

!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 commented 3 years ago

image image image

kamalojasv181 commented 3 years ago

@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 commented 3 years ago

Thank you for the fix!