I am trying to use from summarizer import Summarizer, TransformerSummarizer (a.k.a. bert-extractive-summarizer) library in python to do text summerization with models like Bert, Gpt-2 and others...
But when I try this import I get an error (ie. warning but I can't run my code):
UserWarning: "sox" backend is being deprecated. The default backend will be changed to "sox_io" backend in 0.8.0 and "sox" backend will be removed in 0.9.0. Please migrate to "sox_io" backend. Please refer to https://github.com/pytorch/audio/issues/903 for the detail.
warnings.warn(
then traceback and at the end this:
AttributeError: module transformers.models.cpm has no attribute CpmTokenizer
Who can I fix this?
PS: I saw on the github that the solution to torchaudio problem is to use torchaudio.set_audio_backend("sox_io") , but how should I use it is not clarified if anyone knows the solution to the problem let them write a detailed step by step process.
I would suggest installing package tensorflow-gpu before importing any transformers library, as it internally checks if TensorFlow is installed.
pip install tensorflow-gpu
more information on how to install Tensorflow with GPU on Tensorflow
Related
I am using Google Colab. The link for the project is here: https://colab.research.google.com/drive/1K8aaNq5ZTXQM1zzhaWICuuY5nA06Qn7z?usp=sharing
The error:
I am learning from a course I found online on https://www.udemy.com/. I do not not know much about tensorflow and I don't know why I am getting this error. You may take a look inside the project and help me find out what I am doing wrong here.
Google Colab specifies
We recommend against using pip install to specify a particular TensorFlow version for both GPU and TPU backends.
You can read it here
So I would suggest you directly import dependencies for the project.
import numpy as np
import datetime
import tensorflow as tf
from tensorflow.keras.datasets import fashion_mnist
tf.__version__
gives output
2.3.0
this might not be directly a solution to your issue but seems worth noting. When I tried your notebook I had an issue importing 'export_saved_model'.
The solution to that seems to be here on this github repo:
https://github.com/tensorflow/models/issues/8450
Also, maybe worth noting is that you dont need to install tensorflow into colab as per this tutorial:
https://colab.research.google.com/notebooks/tensorflow_version.ipynb
Hope this helps. Good luck on your course.
This issue was raised before as well but the problem persists for me. I am trying to build a
training detector model using tensorflow. I will tell whatever I have tried so far :
Replacing tf.contrib with TPUStrategy. Any suggestions on applying this feature on my code will be
grateful. (https://github.com/tensorflow/tensorflow/issues/26513)
Tried installing pycocotools for model_main.py
Instead of "import tensorflow as tf" tried "import tensorflow.compat.v1 as tf"
Tried replacing "contrib" with "experimental"
Tried installing tensorflow addons
As per the release notes https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0-alpha0 , it says
tf.contrib has been deprecated, and functionality has been either migrated to the core TensorFlow API, to tensorflow/addons or removed entirely.
If it is migrated to tensorflow addons, which addon is it?
I've tried almost everything.
Tensorflow Version: 2.0
Getting error in the line:
slim_example_decoder = tf.contrib.slim.tfexample_decoder
Can anyone provide me with any alternative?
tensorflow.contrib does not exist anymore. Any code that relies on it is obsolete and needs to be updated (and this is no trivial task).
As of now, the tensorflow object detection API still does not support Tensorflow 2.0, because most of the models in the API are built with TF Slim, which was part of contrib an has been dropped. There is an external package for slim, but AFAIK that's not officially supported (and it's a temporary solution, at best).
Until the object detection API supports TF2, your quickest solution is to downgrade your tensorflow to 1.15.
For a university we are supposed to implement a TensorFlow project using the python libraries for tensorflow and keras. I can install both of them just fine using pip3, but executing any piece of code results in some kind of error.
I've settled on testing the very complicated code:
import keras
Using python 3.6 and the newest tensorflow and keras (pip3 install tensorflow keras) I get the error ModuleNotFoundError: No module named 'tensorflow.python'; 'tensorflow' is not a package. I checked, and import tensorflow finds the package, but returns some error about AVX instructions and dumps the core.
I researched, and my CPU does not support AVX instructions which are part of tensorflow >= 1.6.0. I could not find a precompiled version that runs on my laptop without AVX, and I don't have the time to compile myself.
I tried downgrading to tensorflow == 1.5.0 and keras == 2.1.3 which was the version when tensorflow == 1.5.0 was around, but I still get missing errors, for each version and import statement a different one.
For example when I use the code:
import keras
from keras.datasets import mnist
I instead get the error AttributeError: module 'keras.utils' has no attribute 'Sequence'. I'm on an Intel Pentium, which I assume is the problem. I am fully aware that my setup is in no way suitable for machine learning, and it isn't supposed to be, but nevertheless I'd like to work on that assignment.
Anyone got experience with installing TensorFlow on older machines?
System:
Ubuntu 18.04.2 LTS
Intel(R) Pentium(R) 3556U # 1.70GHz (Dual Core)
4GB RAM
I had the same trouble, but it seems to have solved it. (However, the Python version shall be 3.5. )
For CPUs that do not support AVX, the tensorflow must be version 1.5 or lower.
If you want to install Tensorflow 1.5, the Python version must be 3.5 or lower.
The successful procedure is as follows.
(1) Uninstall your Anaconda.
(2) Download the following version of Anaconda from the following
URL. Version: Anaconda3-4.2.0-Windows-x86_64.exe
URL:https://repo.anaconda.com/archive/ or https://repo.anaconda.com/archive/Anaconda3-4.2.0-Windows-x86_64.exe
(3) Double-click the anaconda icon of “(2)” above, and install the
anaconda according to the GUI instructions.
(4) Start Anaconda Prompt
(5) Enter “pip install tensorflow==1.5” in Anaconda Prompt and press
the return key. Wait for the installation to finish. (See the log)
(6) Enter "pip install keras==2.2.4" in Anaconda Prompt and press the
return key. Wait for the installation to finish.(See the log)
This completes the installation. If you Enter " import tensorflow " on Jupiter notebook, some future error may displayed.(See this log.)
System:
My PC does not support AVX like your PC. My PC's specs are as follows.
PC:Surface Go
CPU:Intel(R) Pentium(R) CPU 4415Y @ 1.60 GHz
Windows10:64bit
How to test ?
Enter and execute the following command on Jupiter Note. Or use this file.
import tensorflow as tf
print(tf.__version__)
print(tf.keras.__version__)
or
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
If your install is successful, then following message will be displayed on your Jupiter notebook
1.5.0
2.1.2-tf
P.S.
I'm not very good at English, so I'm sorry if I have some impolite or unclear expressions.
Sticking to the Pentium configuration is not recommended for default tensorflow builds because of AVX dependencies. Also many recent advances in this area are not available in earlier builds of TF and you will find it difficult to replicate research works. Options below:
Get a Google Colab (https://colab.research.google.com/) notebook, install Keras and TF and get going with your work
There have been genuine requests for this support, refer to this link [https://github.com/tensorflow/tensorflow/issues/18689] where unofficial builds are provided. See if one of them works
Build Tensorflow from scratch (very hard option), with the right set of flags for Bazel (remove all AVX/threading options)
I'm new on python spacy package.
I wanted to download model 'en_core_web_sm' and I get AttributeError.
I searched since 2 days all over the web and I couldn't fix it.
Someone can help me please ?
The code :
import spacy
nlp=spacy.load('en_core_web_sm')
The error :
n = y.shape[0]
AttributeError: 'NoneType' object has no attribute 'ndarray'
I'm using Python 3.6 on conda environment (spyder)
This happened to me once during development and the reason was that for some reason, my code tricked spaCy into thinking I was on GPU. On GPU, spaCy uses cupy instead of numpy – and if cupy is not installed, it defaults to None. It's likely that the code should be calling numpy.ndarray, but it's calling cupy.ndarray, i.e. None.ndarray, which results in that error.
If you've intended to run spaCy on GPU, make sure it's available and you've installed the correct dependencies for your CUDA version. If you're running spaCy on CPU, here are some things to try:
Check what's installed in your environment and make sure you didn't accidentally end up with a half-broken install of cupy or something like that. Also make sure numpy is installed correctly.
Unsatisfying answer, but often helps: uninstall spaCy and its dependencies, and reinstall the latest version, ideally in a clean virtual environment.
I followed the install from this page :
https://alliseesolutions.wordpress.com/2016/09/08/install-gpu-tensorflow-from-sources-w-ubuntu-16-04-and-cuda-8-0-rc/
Had no issues for all the steps, installed CUDA 8.0 and Cudnn5.1 before hand. (Couldn't specify 5.1 during the configure of TensorFlow, so I said 5)
I am not using anaconda or a virtual environment.
Here is what I'm getting :
I pointed towards python3.5, so I launch python3 in command line, import tensorflow as tf, try to run the example from the webpage (or on the tensorflow website: https://www.tensorflow.org/versions/master/get_started/os_setup#test_the_tensorflow_installation), and I get errors such as :
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
AttributeError: module 'tensorflow' has no attribute 'constant'
My guess is it can't find any of the submodules of tensorflow, and when I do dir(tf) I get :
['doc', 'loader', 'name', 'package', 'path', 'spec']
Which I'm guessing is way less than it should.
This is very similar to an issue on github of tensorflow : https://github.com/tensorflow/tensorflow/issues/3369
But it hasn't helped me.
I've removed the tensorflow folder and reinstalled couple times, I didn't try to re install CUDA cause I don't think the problem comes from there.
Any thoughts?
Between the initial tutorial, the Tensorflow Install page and this other tutorial : http://withr.me/install-tensorflow-ubuntu-16-04/ , I managed to install Tensorflow with Python 3.5.
Unfortunately I don't have a clear idea how I did it, I just took pieces from the three parts.