Getting an runtime error while using ViT Pre -Trained model - deep-learning

I have been trying to develop an image classification model using ViT and done with it till model building phase.
when I'm trying to train the model it's showing an error of this kind this is the error
And I'm attaching an full code regarding my model Model Notebook
Thanks & Regards
Satwik Sunnam

Related

"TypeError: container is undefined" when selecting element created with sceneBuilder using AggregatedView

I'm getting Uncaught TypeError: container is undefined thrown in a loop when I create a custom geometry.
Geometries are created using code from https://forge.autodesk.com/blog/custom-models-forge-viewer
I'm using the AggregatedView. The error does not occur when I instantiate a GuiViewer3D directly.
Uncaught TypeError: container is undefined
getFragmentConsolidationType ConsolidationIterator.js:398
updateRenderProxy ConsolidationIterator.js:416
updateRenderProxy RenderModel.js:973
updateSelectionProxies Viewer3DImpl.js:2145
renderOverlays Viewer3DImpl.js:2152
cmdRenderOverlays Viewer3DImpl.js:1330
executeCommandList Viewer3DImpl.js:913
tick Viewer3DImpl.js:1908
animloop Viewer3DImpl.js:1939
Is this a bug in Autodesk Forge? Using version 7.80
Selecting a custom geometry with the AggregatedView.
Expected the object to be selected.
Instead an error is thrown continuously.
The engineering team confirmed that this is a problem with the SceneBuilder extension not being compatible with "model consolidation" - a process where multiple meshes are merged into a single GPU buffer to improve rendering performance. The AggregatedView class consolidates models automatically, which is why you're running into this issue.
While we are not planning to add consolidation support to models generated by the SceneBuilder extension, we will update the extension and make sure that this combination is handled gracefully. In the meantime, if you need to use SceneBuilder models in an AggregatedView app, please unconsolidate your custom models using model.unconsolidate().

OSError: [E053] Could not read meta.json from C:\Users\155658\NER\model.pkl

There is a pre-trained NER model and I want to test how well it's performing so I just loaded with spacy
mdl = spacy.load("..../model.pkl")
But getting error says couldn't read meta.json. what exactly error means.

How do I register a dataset to use with detectron2? We have images and their annotations in COCO JSON format

I am trying to train a model using Detectron2. I am using Grocery image data and I have annotations in COCO format. I am having a problem with model loading. Model is not taking annotations. I am referring to this blog https://gilberttanner.com/blog/detectron2-train-a-instance-segmentation-model.
Facing issue in registering the dataset.
from detectron2.data.datasets import register_coco_instances
for d in ["train", "test"]:
register_coco_instances(f"microcontroller_{d}", {}, f"Microcontroller Segmentation/{d}.json", f"Microcontroller Segmentation/{d}")
Is there any problem with this code?
I think this might help you
from detectron2.data.datasets import register_coco_instances
register_coco_instances("YourTrainDatasetName", {},"path to train.json", "path to train image folder")
register_coco_instances("YourTestDatasetName", {}, "path to test.json", "path to test image folder")
Let me know if it works for you.I have trained detectron2 using this :)

A simple distributed training python program for deep learning models by Horovod on GPU cluster

I am trying to run some example python3 code
https://docs.databricks.com/applications/deep-learning/distributed-training/horovod-runner.html
on databricks GPU cluster (with 1 driver and 2 workers).
Databricks environment:
ML 6.6, scala 2.11, Spark 2.4.5, GPU
It is for distributed deep learning model training.
I just tried a very simple example at first:
from sparkdl import HorovodRunner
hr = HorovodRunner(np=2)
def train():
print('in train')
import tensorflow as tf
print('after import tf')
hvd.init()
print('done')
hr.run(train)
But, the command is alway running without any progress.
HorovodRunner will stream all training logs to notebook cell output. If there are too many
logs, you
can adjust the log level in your train method. Or you can set driver_log_verbosity to
'log_callback_only' and use a HorovodRunner log callback on the first worker to get concise
progress updates.
The global names read or written to by the pickled function are {'print', 'hvd'}.
The pickled object size is 1444 bytes.
### How to enable Horovod Timeline? ###
HorovodRunner has the ability to record the timeline of its activity with Horovod Timeline.
To
record a Horovod Timeline, set the `HOROVOD_TIMELINE` environment variable to the location
of the
timeline file to be created. You can then open the timeline file using the chrome://tracing
facility of the Chrome browser.
Do I miss something or need to set up something to make it work ?
Thanks
your code does no actual training within it.. you might have better luck with the better example code
https://docs.databricks.com/applications/machine-learning/train-model/distributed-training/mnist-pytorch.html

mlmodel doesn’t work properly after conversion from Caffe using coremltools

I want to convert this NSFW model to CoreML model. What I did:
Download Anaconda 2.7
Install coremltools
Convert this yahoo nsfw model from here - https://github.com/yahoo/open_nsfw/tree/master/nsfw_model but I am not sure it’s Caffe v1 because Apple documentation says that only this version supported. Anyway…
I use this commands for conversion and it converted without any warnings.
coreml_model = coremltools.converters.caffe.convert(('resnet_50_1by2_nsfw.caffemodel', 'deploy.prototxt'), image_input_names='data')
coreml_model.save(’nsfw2.mlmodel')
I imported this model to my project and again all looks fine.
I prepared 224x224 images and use Vision framework like VNImageRequestHandler with cgImage and etc.
But!
All images return the same result
[<VNCoreMLFeatureValueObservation: 0x281b1daa0> 2E00F417-95C0-4AA1-A621-A0945BB5E095 requestRevision=1 confidence=1.000000 "prob" - "MultiArray : Double 1 x 1 x 2 x 1 x 1 array" (1.000000)]
How can I debug this issue and found out what’s wrong?
Maybe you're looking only at naughty images? ;-)
It's probably the image preprocessing. You didn't specify any preprocessing options while Caffe models usually normalize using ImageNet mean/std. Refer to my blog post for more info: https://machinethink.net/blog/help-core-ml-gives-wrong-output/
However, I don't see any normalization options in your deploy.prototxt, so perhaps it's not that.
How I would debug this: remove everything but the first layer from the Caffe model and convert to Core ML. Run this one-layer model in both Caffe and Core ML and compare the outputs. If they are different, something is up with how you're loading or preprocessing the input data.