Huggingface Transformers - AttributeError: 'MrpcProcessor' object has no attribute 'tfds_map' - transformer-model

When using Hugginface Transformers on GLUE task, I've got the error AttributeError: 'MrpcProcessor' object has no attribute 'tfds_map'
I suspect a problem of compatibility.

My solution was to simply to downgrade the version of transformers to 2.2.0
pip uninstall transformers -y
pip install transformers==2.2.0

Right now I am using transformers 2.11.0 and this code works for me:
# First we create an empty Byte-Pair Encoding model (i.e. not trained model)
tokenizer = Tokenizer(BPE())
tokenizer.normalizer = Sequence([
NFKC(),
Lowercase()
])
So there seems to be a constructor which you can use.

Related

Sklearn installation

I have installed sklearn library using
pip install sklearn
but while importing it it shows there is no any library called sklearn that is it gives import error
and afterwars i checked again installing using same command mentioned above but it says requirement already satisfied.
Why it showing like this?
What may be the solution for it? Here is the problem screenshot while importing
It's in CMD
C:\Users\scann>pip install sklearn
Requirement already satisfied: sklearn in c:\users\scann\appdata\local\programs\python\python310\lib\site-packages (0.0.post1)
C:\Users\scann>pip install -U sklearn
Requirement already satisfied: sklearn in c:\users\scann\appdata\local\programs\python\python310\lib\site-packages (0.0.post1)
I tried many methods for installation using github and using -U
But also i Didn't find any correct solution
As of today (2023-01-09), pip install sklearn is in a "brownout" period, and installing this way will eventually be removed.
The preferred installation method is:
pip install scikit-learn
The reason for deprecation is listed as:
sklearn package on PyPI exists to prevent malicious actors from using the sklearn package, since sklearn (the import name) and scikit-learn (the project name) are sometimes used interchangeably. scikit-learn is the actual package name and should be used with pip.
Further reading:
https://github.com/scikit-learn/sklearn-pypi-package
https://github.com/scikit-learn/scikit-learn/issues/24204

How to install older version of statsmodels

Is there a way to install an older version of statsmodels? Such as using pip install statsmodels x.xx? I cant find any documentation on their website about this. Thanks
I've tried using the current version but encounter errors when running the code. if i use import statsmodels.tsa.arima_model.ARMA i get the following error
statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA
When i replace arima_model with arima.model other lines of code will not work such as
` 2 # Build Model
3 model = ARIMA(train_data, order=(1,1,0))
----> 4 fitted = model.fit(disp=-1)
5 print(fitted.summary())
TypeError: fit() got an unexpected keyword argument 'disp'`
I'd like to revert the version of statsmodels so i can get the program to run

Cant use the module 'DynamicFactorMQ'

I get the error:
AttributeError: module 'statsmodels.tsa.api' has no attribute 'DynamicFactorMQ'
model = sm.tsa.DynamicFactorMQ(
endog_m, endog_quarterly=endog_q,
factors=factors, factor_orders=factor_orders,
factor_multiplicities=factor_multiplicities)
This error is most likely coming up because you have an older version of Statsmodels installed. DynamicFactorMQ was introduced in version 0.12, so you should make sure that you're using a new enough version. You can check using:
import statsmodels.api as sm
print(sm.__version__)

How to use Normal constructor correctly in pymc3?

When I use pymc3 to construct a normal distribution, I got error message. How to solve this problem?
I installed PyMC3 with windows Anaconda (version Anaconda3-2019.03-Windows-x86_64.exe). And running codes from official pymc3 tutorial "Getting started with PyMC3".
I tried to build a normal distribution with Normal constructor pm.Normal(). The codes are listed below
import numpy as np
import pymc3 as pm
basic_model = pm.Model()
with basic_model:
# Priors for unknown model parameters
alpha = pm.Normal('alpha', mu=0, sigma=10)
But got error message as the following:
AttributeError: module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'
The problem is solved by removing theano 1.0.3 from Anaconda and performing pip install the latest version >=1.0.4.

'module' object has no attribute 'MutableMapping' issue in Caffe

My Caffe was running fine but then I installed Keras which gave the following error:
'module' object has no attribute 'MutableMapping'
According to some advice, I updated Protobuf following these instructions of building from sources.
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
And the result now is that neither Keras nor Caffe is running and I get the same error:
File "/home/myuser/anaconda2/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 50, in <module>
from google.protobuf.pyext import _message
AttributeError: 'module' object has no attribute 'MutableMapping'
Of all the things, I would perhaps first try to uninstall the new version of Protobuf but how should I do it to go back to the previous state? And secondly, how to install the Protobuf so that Keras can also run?
The issue seemed to be having two protobuf installations at the same time.

Resources