transformers: Name Error: "Partial State" is not defind
Parital State is not defined
-
In your recent release: 4.29.0.dev.0 has some issues with the code. The function or method “Partial State” is not defined. Today - I am not able to train my model. I just downloaded 4.28.0 to resolve this issue. Can you kindly check ASAP?
-
This error I am getting in the “Training arguments” method.
-
The training arguments script does not define or import the “Partial State” method or function.
Solution:
- For now, install the previous stable version of transformers.
pip install transformers==4.28.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 15
- Comments: 26 (5 by maintainers)
True.
!pip install transformers==4.28.0for previous version is easier solution. The newer version runs into dependency issues.Hi @creek411 install version 4.28.0 of transformers by running this code
!pip install transformers==4.28.0. Then restart and run all the code( if ur using colab).Please also remember to restart the kernel ( Given you are using Colab/Jupyter ) ( I know it is silly but yes )
Bro, you don’t need to worry too much. Please downgrade the version. They are having stable version. Don’t stress too much. Previous version working as usual. We changed all our requirements today. Hectic process 😦
@RAravindDS Thanks for reporting. I suspect the issue is coming from the version of accelerate in your environment. Could you:
transformers-cli envin your terminal THENpip install --upgrade accelerateI’m using Jupyter (as well as the VS Code notebooks extension, which is essentially the same) on Python 3.11 with no venv and the interpreter provided by
asdf.On re-test,
accelerate0.19 did work withtransformers4.29, as it turned out; I’m just not accustomed to notebooks and forgot that I needed to restart the kernel to freshen the dependencies. Classic n00b mistake.I’m still a bit mystified as to why I had an older
accelerate, as I had created my entire Python environment on the same day I commented. Possibly, it was a transitive dependency of something else I’d already installed.@creek411 the solution would be to do
pip install accelerate(and as now we have a release, it works OOTB with the normal pypi install), however the fact you have the error means you still probably are installing from dev and there’s some cache working in there. You can trypip uninstall transformers -y, run your code, make sure it fails becausetransformersisn’t installed, then installtransformersagain, either 4.28.0 or 4.29.0 and dopip install accelerateas wellFor those having issues, can you tell me more about if you are working in Jupyter, Colab, or in regular Python? Again the solution hasn’t changed: in the correct environment you need to make sure that
accelerateis installed and viewable. To test this in your environment you can try importing itimport accelerate. If it fails, it’s not installed correctly.Gracias amigo
Esto me funciono en colab, pero es importante reiniciar el entorno de ejecución
!pip uninstall -y -r transformers accelerate !pip install transformers==4.29.0 !pip install git+https://github.com/huggingface/accelerate
I get the same error with
on Colab
I had to install accelerate manually.
!pip install torch "argilla" datasets accelerate transformers setfitI attempted to do your solution and could avoid the error. I appreciate for your advise.
Thank you for your reply. I tried to install 4.28.0 and run the code. However, this error recurred. In this code, I install and use
transformers datasets. So should I installtransformers datasetsof previsous version?I am using the following version of transformer, datasets and huggingface_hub.
I am running into the following error:
How to resolve this issue to work with my versions of the transformer, datasets and huggingface_hub ?
@RAravindDS Yes, this is because the
PartialStateimport was added as a dependency on the transformers development branch yesterday.PartialStatewas added in the 0.17.0 release in accelerate, and so for the development branch of transformers, accelerate >= 0.17.0 is required.Downgrading the transformers version removes the code which is importing
PartialState.