-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
TypeError: 'NoneType' object is not subscriptable in modeling_utils.py #21995
Comments
I think this has been fixed by #21542. Could you try on the main branch of Transformers and see if you still have the bug? |
Oh yes perfect! I'll wait for the next release to update then. |
Next release should be this week or beginning of next, as an FYI :-) |
I am still having the same problem when running Detoxify. The code I implemented is below:
Please advise on how I can make it work. |
This is unrelated to |
Thank you, @ArthurZucker, for your quick response. Could you point me in the right direction, please? What do I need to do to make Detoxify work? |
I would submit the issue to |
System Info
Using free tier Google Colab, it gives the following output of
transformers-cli env
:2023-03-07 12:26:45.314129: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia
2023-03-07 12:26:45.314255: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia
2023-03-07 12:26:45.314280: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
WARNING:tensorflow:From /usr/local/lib/python3.8/dist-packages/transformers/commands/env.py:52: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use
tf.config.list_physical_devices('GPU')
instead.2023-03-07 12:26:49.528826: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:42] Overriding orig_value setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
transformers
version: 4.26.1Who can help?
@sgugger
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Using the library Detoxify raises an error in transformers code if using transformers version >= 4.25.1, but works well with version 4.24 and below.
The error is:
TypeError: 'NoneType' object is not subscriptable
in filemodeling_utils
at line 2718. This line (and its block of code) has been added with PR#20321 merged in version 4.25.1transformers/src/transformers/modeling_utils.py
Lines 2718 to 2736 in 820c46a
Looking at the code, it seems to me that the variable
resolved_archive_file
can take the valueNone
, hence raising this error.The full error stacktrace is:
PS: link to the related issue in the library Detoxify
Expected behavior
Put a condition on
resolved_archive_file
to handle the case when its value isNone
.However, if its value SHOULDN'T be
None
, then add a validity check earlier in the code, with more explicit details.Let me know if I can help on this.
The text was updated successfully, but these errors were encountered: