When i try to run the efficientNetv2 model
I got this erreur Error-message
AttributeError: module'tensorflow.keras.applications ' has no attribute 'efficientnet_v2'
Tensorflow version : tensorflow-gpu:2.6
The import is incorrect, you need to update it, it might have worked in older Keras versions,but the internal per-network modules inside keras.applications are not exposed anymore, so your correct import would be:
keras.applications.EfficientNetV2S
Or if you use tf.keras:
tf.keras.applications.EfficientNetV2S
For future reference, always check the documentation, for EfficientNetV2S the link is here.
install efficientnet in you env
!pip install keras-efficientnet
then you can import model as
import efficientnet.tfkeras as efc
done...
you can use prefix 'efc' for B0-B7
Related
Code:
import graphing
graphing.scatter_2D(dataset, label_x="harness_size",
label_y="boot_size",
trendline=lambda x: fitted_model.params[1] * x + fitted_model.params[0]
)
Why do I have this error:
module 'graphing' has no attribute 'scatter_2D'
It's from an Azure course.
Try to install the library, it's okay for this.
In the very first cell, there was a line:
!wget https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/graphing.py
The Graphing.py file has a method defined as scatter_2D. If you are running this on your jupyter notebook, wget needs to be installed.
Edited: Or follow #wayne instructions from comment below
I'm taking a Microsoft PyTorch course and trying to implement on Kaggle Notebooks but I kept having the same error message over and over again: "ModuleNotFoundError: No module named 'onnxruntime'". I've checked everywhere possible if I could find a solution to it but none, I even tried installing it manually using pip in the notebook, but it's still not working. I've checked the official onnxruntime website and documentation but there's nowhere it states anything about something being outdated or any other issue. Someone help. My code won't run because it says "onnxruntime is not defined". Here are my imports:
%matplotlib inline
import torch
import onnxruntime
from torch import nn
import torch.onnx as onnx
import torchvision.models as models
from torchvision import datasets
from torchvision.transforms import ToTensor
and the code cell I'm trying to run
session = onnxruntime.InferenceSession(onnx_model, None)
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
result = session.run([output_name], {input_name: x.numpy()})
predicted, actual = classes[result[0][0].argmax(0)], classes[y]
print(f'Predicted: "{predicted}", Actual: "{actual}"')
And you can find the complete notebook here: https://www.kaggle.com/faisalalbasu/complete-model
the error occurs because "import" cannot find onnxruntime in any of the paths, check where import is searching and see if onnxruntime is in there.
check what path pip install installs to, that way in the future you won't have the same problem! :)
This code was running without any problems before I updated my python and fastai:
from fastai import *
from fastai.vision import *
import torch
...
tfms = get_transforms(do_flip=True,flip_vert=True,max_rotate=360,max_warp=0,max_zoom=1.1,max_lighting=0.1,p_lighting=0.5)
After updating the fastai to 2.1.2 and python to 3.8.5, I'm getting this error: NameError: name 'get_transforms' is not defined.
How can I fix it?
For Data Augmentation methods in FastAI 2 you have to use other methods names, for example:
aug_transforms
I got the same question, fastai 1.0.61 could probably solve the problem.
Enter this code at the very beginning and download it :
!pip install "torch==1.4" "torchvision==0.5.0"
Currently I am using transformers(3.0.2) and python(3.7.3) which encountered the below error:
cannot import name 'TFBertForQuestionAnswering' from 'transformers'
from transformers import BertTokenizer, TFBertForQuestionAnswering
model = TFBertForQuestionAnswering.from_pretrained('bert-base-cased')
f = open(model_path, "wb")
pickle.dump(model, f)
How do resolve this issue?
Upgrade your TensorFlow library. It works fine with 2.3.1. version.
Some TensorFlow components are only available when you have TensorFlow2 installed. Make sure you have the required version for the environment you are working on!
I'm struggle with running module.
from tensorflow import Session, ConfigProto, GPUOptions
gpuoptions = GPUOptions(allow_growth=True)
session = Session(config=ConfigProto(gpu_options=gpuoptions))
K.set_session(session)
classifier = Sequential()
I don't know why it's not working.
It just shows me:
ImportError: cannot import name 'Session' from 'tensorflow' (C:\Users\hayou\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py)
I guess you're using TensorFlow 2.x. In that case, use tf.compat.v1.--function--() instead.
import tensorflow as tf
gpuoptions = tf.compat.v1.GPUOptions(allow_growth=True)
session = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpuoptions))
K.set_session(session)
classifier = Sequential()
In my case I was using tensorflow v2.2 which doesn't have Session. However it has been present in previous versions, so you might want to install an older version of tensorflow like v1.15 which contains Session class.
pip install tensorflow==1.15
I'm not exactly sure this is the best solution, but it worked for me, so I hope it does work for you as well!