import torch
model = torch.hub.list('pytorch/vision')
My pytorch version is 1.0.0, but I can't load the hub, why is this?
You will need torch >= 1.1.0 to use torch.hub attribute.
Alternatively, try by downloading this hub.py file and then try below code:
import hub
model = hub.list('pytorch/vision', force_reload=False)
Arguments:
github: Required, a string with format repo_owner/repo_name[:tag_name] with an optional tag/branch. The default branch is master if not specified.
Example: pytorch/vision[:hub]
force_reload: Optional, whether to discard the existing cache and force a fresh download.
Default is False.
deinstall torch
reinstall torch==1.9.0, torchvision==0.10.0
and then install the necessary requirments.txt again
Related
My code is as follows:
!pip install flax
init_params = TransporterNets().init(key, init_img, init_text, init_pix)['params']
print(f'Model parameters: {n_params(init_params):,}')
optim = flax.optim.Adam(lr=1e-4).create(init_params)
However it shows the following error:
AttributeError: module 'flax' has no attribute 'optim'
Even though I have seen documentation of optim attribute in flax module. How to fix it?
You can temporarily solve the issue by downgrading flax version from 0.6.0 to 0.5.1 at the moment.
pip install flax==0.5.1
Use this colab
https://colab.research.google.com/drive/12LjJazBl7Gam0XBPy_y0CTOJZeZ34c2v?usp=sharing
my CUDA Version: 11.2
when do this
train_dataset = train_dataset.map(
process_data_to_model_inputs,
batched=True,
batch_size=batch_size,
remove_columns=["article", "abstract", "section_names"],
)
AttributeError: module 'dill._dill' has no attribute 'stack'
I have try this
pip install dill==0.3.4
but not work
How to solve this problems, Thinks!
I'm the dill author. dill._dill.stack is not part of the public interface, and can't be guaranteed to be there. It was removed in 0.3.5 (and above). It is available in 0.3.4. If you have already installed 0.3.5.1 or something larger than 0.3.4, you will need to pip uninstall or force-reinstall the specific package version.
See: Installing specific package version with pip
I wanted to make ctc_decoder using torchaudio ctc_decoder module. According to this tutorial ASR INFERENCE WITH CTC DECODER
it should have been easy to import as usual but I am unable to do so in google colab even after installing torchaudio.
It says ModuleNotFoundError: No module named 'torchaudio.prototype'
How can I import prototype module?
The prototype feature is only available in nightly builds, so one needs to install nightly version, following the https://pytorch.org/get-started/locally/ .
Note that since the release of 0.12, the CTC decoder is in beta and is available as from torchaudio.models.decoder import ctc_decoder.
I use Tensorflow 2.1.0
In this code
data_augmentation = tf.keras.Sequential([
tf.keras.layers.experimental.preprocessing.RandomFlip('horizontal'),
tf.keras.layers.experimental.preprocessing.RandomRotation(0.3)
])
I find this error:
AttributeError: module 'tensorflow_core.keras.layers.experimental.preprocessing' has no attribute 'RandomFlip'
So how can I change it without changing version of tensorflow
To work your code as expected, firstly Tensorflow has to be upgrade to the latest version
! pip install tensorflow --upgrade
If you are looking for solution in TF 2.1.0, then there are two options are available
First solution: tf.image.random_flip_left_right ( horizontal flip)
tf.image.random_flip_left_right(
image, seed=None)
Second solution: tf.keras.preprocessing.image.ImageDataGenerator
tf.keras.preprocessing.image.ImageDataGenerator(
rotation_range=30, horizontal_flip=True)
! pip install tensorflow --upgrade --user
--user option can help you without the permission problem
Add this line to the importing section (of course after import tensorflow as tf)
tf.config.experimental_run_functions_eagerly(True)
Almost any tf.keras.layers.experimental.preprocessing.SomeClass in the listed classes here, should work.
But need to do sanity check with plotting results.
I am trying to use the object detection tutorial from tensor flow api. I am using python 3 and tensor flow version 2. But getting the below error.I tried several ways:
File "C:\Aniruddhya\object_detection\object_detection\utils\label_map_util.py", line 137, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'
can someone help me to run this?
code link: https://drive.google.com/drive/u/3/folders/1XHpnr5rsENzOOSzoWNTvRqhEbLKXaenL
It's not called that in TensorFlow 2. You might be using a TensorFlow 1 tutorial.
Version 1
tf.gfile.GFile
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/io/gfile/GFile
Version 2
tf.io.gfile.GFile
https://www.tensorflow.org/api_docs/python/tf/io/gfile/GFile
If you have Tensorflow version 2. You can use the next module compatible with the version 1, too.
import tensorflow.compat.v1 as tf
I solved this problem by reinstalling tensor using the previous version: sudo pip3 install tensorflow==1.14.0
You may optionally downgrade to previous version of tensorflow:
!pip install tensorflow==1.12.0
import tensorflow as tf
print(tf.__version__)
otherwise , make if tf.io.gfile and import tf.io