AttributeError: module 'torch' has no attribute 'swapaxes' - machine-learning

For some reason when using PyTorch on Google Colab, I'm unable to use torch.swapaxes and returns this error. Am I missing some additional import or something?

Related

neo compilation job failed on Yolov5/v7 model

I was trying to use AWS SageMaker Neo compilation to convert a yolo model(trained with our custom data) to a coreml format, but got an error on input config:
ClientError: InputConfiguration: Unable to determine the type of the model, i.e. the source framework. Please provide the value of argument "source", from one of ["tensorflow", "pytorch", "mil"]. Note that model conversion requires the source package that generates the model. Please make sure you have the appropriate version of source package installed.
Seems Neo cannot recognize the Yolo model, is there any special requirements to the model in AWS SageMaker Neo?
I've tried both latest yolov7 model and yolov5 model, and both pt and pth file extensions, but still get the same error. Seems Neo cannot recognize the Yolo model. I also tried to downgrade pytorch version to 1.8, still not working.
But when I use the yolov4 model from this tutorial post: https://aws.amazon.com/de/blogs/machine-learning/speed-up-yolov4-inference-to-twice-as-fast-on-amazon-sagemaker/, it works fine.
Any idea if Neo compilation can work with Yolov7/v5 model?

Agda Installation PLFA Configuration

I am trying to use the Programming Language Foundation with Agda plfa library, however the import does not appear to be working properly.
I have cloned the repository and added the repository path to: ~/.agda/libraries and plfa to ~/.agda/defaults.
When I create a test.agda file and check a single line
module plfa.part1.Naturals where
I get an import error:
You tried to load /Users/johngfisher/Desktop/agda_test/nats.agda
which defines the module plfa.part1.Naturals. However, according to
the include path this module should be defined in
/Users/johngfisher/agda_env/libraries/plfa/src/plfa/part1/Naturals.lagda.md
The file is present in the location the import is coming from so I am unsure of why Agda is unable to find it. Any help would be appreciated.
module plfa.part1.Naturals where
defines a module named plfa.part1.Naturals
Did you mean to type
module test where
open import plfa.part1.Naturals
instead?

No module named 'data'

I get the error No module named 'data' whenever I try to execute the line below
from data import batch_gen, encode
Can anyone help me fix this? I tried looking into other online resources but could not fix this problem.
try the following and then do your import:
pip install data
The line
from data import batch_gen, encode
lets you import only parts of modules and gives you the possibility to reference them directly without writing data.encode
So to get this running you need a module called data in a file, either a file in the same location as your python file or in the installation folder where the other std python files life. otherwise you would always get an error. more information is easily found here:
https://www.digitalocean.com/community/tutorials/how-to-import-modules-in-python-3#using-from-%E2%80%A6-import

error loading faster_rcnn models into Opencv

I followed exactly every step from TensorFlow Object Detection API and trained the faster_rcnn_resnet50 model. Then I referenced link:Wiki to generate the pbtxt file for cv2 read net.
When I ran the model using opencv, it gave no error most of the time and this error sometimes:
cv2.error: OpenCV(3.4.3)
C:\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:495:
error: (-2:Unspecified error) Input layer not found:
CropAndResize/Reshape/shape in function
'cv::dnn::experimental_dnn_34_v7::anonymous-namespace'::TFImporter::connect'
I tried the optimized tool and re-generated the pbtxt file, but still experienced the same.
Any suggestions to make the model work? Thanks in advance!
Got answer from #dkurt at https://github.com/opencv/opencv/issues/13050
Wish that can help if you are experiencing the same problem

I see an angular2 'bind' function defined in angular2/angular2.d.ts - did it used to be in 'angular2/di.d.ts?

Many of the samples I have seen for angular2 have the following import statement:
import {bind} from 'angular2/di';
I am working in VS Code (with TypeScript) and it complains about not being able to find the angular2/di module.
However I do see a bind function defined in angular2/angular2.d.ts. If I change the import statement to the following, then the error goes away.
import {bind} from 'angular2/angular2';
Is the question in the title off-base and I am making some erroneous assumption?
If not, why do many samples reference one module to import the bind function from, yet I seem to be able to get it from a different module?
Most likely because you looked at versions from older alphas. Look at the angular2.ts file. Everything is exported from it. Also note that the d.ts is going to contain everything to resolve types in your IDE and at compilation time. What import does is actually importing the .js files.

Resources