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"
Related
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
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! :)
I am very new to sentiment analysis. Trying to use Stanford Sentiment Treebank(sst) and ran into an error.
from nltk.tree import Tree
import os
import sst
trees = "C:\\Users\m\data\trees"
tree, score = next(sst.train_reader(trees))
[Output]:
AttributeError Traceback (most recent call last)
<ipython-input-19-4101f90b0b16> in <module>()
----> 1 tree, score = next(sst.train_reader(trees))
AttributeError: module 'sst' has no attribute 'train_reader'
I think you're looking for https://github.com/JonathanRaiman/pytreebank, not https://pypi.org/project/sst/.
On the python side, that error is pretty clear. Once you import the right package, though, I'm not sure I saw train_reader but I could be wrong.
UPDATE:
I'm not entirely sure why you're running into the 'sst' not having the attribute train_reader. Make sure you didn't accidentally install the 'sst' package if you're using conda. It looks like the 'sst' is referring to a privately created module and that one should work.
I got your import working but what I did was I:
Installed everything specified in the requirements.txt file.
import sst was still giving me an error so I installed nltk and sklearn to resolve that issue. (fyi, im not using conda. im just using pip and virtualenv for my own private package settings. i ran pip install nltk and pip install sklearn)
At this point, import sst worked for me.
I guess you're importing the sst package selenium-simple-test, which is not what you're looking for.
Try sst.discover() , if you get the error
TypeError: discover() missing 4 required positional arguments: 'test_loader', 'package', 'dir_path', and 'names'
You are using the selenium-simple-test package
I've instaled geolocation-python
https://pypi.python.org/pypi/geolocation-python/0.2.0
pip install geolocation-python
And I'm trying to follow the example, but at the first line:
from geolocation.google_maps import GoogleMaps
I get an error:
No module named google_maps
I think you should use:
from geolocation.main import GoogleMaps
instead. It worked for me.
See here: https://pypi.python.org/pypi/geolocation-python/0.2.2