PermissionError During loading a pytorch model - deep-learning

model = torch.hub.load('ultralytics/yolov5', 'custom', path='yolov5-master/yolov5-master/runs/train/weights/last.pt', force_reload=True)
When I run this line of code in my Jupyter notebook, I get a permission error:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\username/.cache\\torch\\hub\\ultralytics_yolov5_master\\requirements.txt'

Related

Failed to load Json File in Kaggle Kernel using load_dataset(), but works in Google Colab and Local System

I am trying to load a json file using the load_dataset method in the Huggingface Datasets library in the Kaggle Kernel. This is the code:
data=load_dataset("json",data_files="/kaggle/input/dataset/gold_summaries_test.json")
I get the following error only when I am working in the Kaggle Kernel.
AttributeError: 'list' object has no attribute 'keys'
Below is a preview of the json file I am trying to load.
gold_summaries_test.json
This error does not occur when loading the file in Google Colab, or on a python console in my local system.

I am getting attribute Error while running train.py in YOLOV5. Can anyone help me with this?

When I run python train.py --img 640 --batch 4 --epochs 5 --data training/dataset.yaml --cfg training/yolov5l.yaml --weights yolov5l.pt for YOLO V5 in my system I get the following nd why is it:
Traceback (most recent call last):
File "train.py", line 544, in
train(hyp, opt, device, tb_writer)
File "train.py", line 72, in train
wandb_logger = WandbLogger(opt, save_dir.stem, run_id, data_dict)
File "D:\sandra\ai.projects\yolo\yolov5\utils\wandb_logging\wandb_utils.py", line 108, in init
self.data_dict = self.setup_training(opt, data_dict)
File "D:\sandra\ai.projects\yolo\yolov5\utils\wandb_logging\wandb_utils.py", line 139, in setup_training
self.train_artifact_path, self.train_artifact = self.download_dataset_artifact(data_dict.get('train'),
AttributeError: 'str' object has no attribute 'get'
wandb: Waiting for W&B process to finish, PID 22204
wandb: Program failed with code 1.
wandb: Find user logs for this run at: D:\sandra\ai.projects\yolo\yolov5\wandb\offline-run-20210427_130128-jr2z73rr\logs\debug.log
wandb: Find internal logs for this run at: D:\sandra\ai.projects\yolo\yolov5\wandb\offline-run-20210427_130128-jr2z73rr\logs\debug-internal.log
wandb: You can sync this run to the cloud by running:
wandb: wandb sync D:\sandra\ai.projects\yolo\yolov5\wandb\offline-run-20210427_130128-jr2z73rr
Looking at the error traceback, it seems that your dataset configuration file has some missing info, or most likely in the wrong format. The file should contain both training and validation set paths. Here's an example:
train: path/to/train # Notice the spaces
val: path/to/val
...

gcloud crashing due to (SSLHandshakeError): [SSL: UNKNOWN_PROTOCOL]

I have installed gcloud sdk by following the link https://cloud.google.com/sdk/docs/downloads-apt-get on Ubuntu 16.04.6 LTS. I have also done the proxy configuration using the following link https://cloud.google.com/sdk/docs/proxy-settings.
Google Cloud SDK 288.0.0
alpha 2020.04.03
beta 2020.04.03
bq 2.0.56
core 2020.04.03
gsutil 4.49
kubectl 2020.04.03
gcloud init is successful and gcloud info --run-diagnostics displays no problems. However gcloud crashes for any other commands I run. I have tried the following commands.
1. gcloud compute images list
2. gcloud services list
3. gcloud logging logs list
Here is the message I get after the crash.
ERROR: gcloud crashed (SSLHandshakeError): [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
Can someone please help.
PS. Here is debug output.
DEBUG: Running [gcloud.compute.images.list] with arguments: [--verbosity: "debug"]
INFO: Refreshing access_token
INFO: Display format: " table(
name,
selfLink.map().scope(projects).segment(0):label=PROJECT,
family,
deprecated.state:label=DEPRECATED,
status
)"
DEBUG: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
display_info=self.ai.display_info).Display()
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/display.py", line 483, in Display
self._printer.Print(self._resources)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_printer_base.py", line 275, in Print
for resource in resources:
File "/usr/lib/google-cloud-sdk/lib/surface/compute/images/list.py", line 113, in _FilterDeprecated
for image in images:
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/lister.py", line 1065, in __call__
errors=errors):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/request_helper.py", line 204, in ListJson
for item in _ListCore(requests, http, batch_url, errors, _HandleJsonList):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/request_helper.py", line 134, in _ListCore
requests=requests, http=http, batch_url=batch_url)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/batch_helper.py", line 106, in MakeRequests
batch_request_callback=batch_checker.BatchCheck)
File "/usr/bin/../lib/google-cloud-sdk/lib/third_party/apitools/base/py/batch.py", line 226, in Execute
batch_http_request.Execute(http)
File "/usr/bin/../lib/google-cloud-sdk/lib/third_party/apitools/base/py/batch.py", line 492, in Execute
self._Execute(http)
File "/usr/bin/../lib/google-cloud-sdk/lib/third_party/apitools/base/py/batch.py", line 449, in _Execute
response = http_wrapper.MakeRequest(http, request)
File "/usr/bin/../lib/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 356, in MakeRequest
max_retry_wait, total_wait_sec))
File "/usr/bin/../lib/google-cloud-sdk/lib/third_party/apitools/base/py/http_wrapper.py", line 304, in HandleExceptionsAndRebuildHttpConnections
raise retry_args.exc
SSLHandshakeError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
ERROR: gcloud crashed (SSLHandshakeError): [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
I got it working after some debugging. Seems like firewall was the issue in my case. I shifted to python 3.5 . After which I ran the same command gcloud compute images list
I got the error "Caught socket error, retrying request to url https://compute.googleapis.com/batch/compute/v1". Adding this url to firewall exception solved my issue.

How do I connect Airflow to SQLite locally?

I'm trying to try out Airflow for the very first time and I'm trying to connect it to a local SQLite database. But I can't seem to get my head around on how to actually do it.
I've read up on Airflow's document, Set my executor to LocalExecutor and set up my sql_alchemy_conn to sqlite:////home/myName/Programs/sqlite3/DatabaseName.db but it doesn't seem to work as it throws an
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 21, in <module>
from airflow import configuration
File "/usr/local/lib/python2.7/dist-packages/airflow/__init__.py", line 35, in <module>
from airflow import configuration as conf
File "/usr/local/lib/python2.7/dist-packages/airflow/configuration.py", line 520, in <module>
conf.read(AIRFLOW_CONFIG)
File "/usr/local/lib/python2.7/dist-packages/airflow/configuration.py", line 283, in read
self._validate()
File "/usr/local/lib/python2.7/dist-packages/airflow/configuration.py", line 169, in _validate
self.get('core', 'executor')))
airflow.exceptions.AirflowConfigException: error: cannot use sqlite with the LocalExecutor
error when I tried to run airflow initdb. I tried to google around and tried vipul sharma's solution found here and set the value of my sql_alchemy_conn to mysql://:#localhost:3306/ but it still doesn't work as it throws an
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'myName'#'localhost' (using password: NO)")
error. I know that the answer should be really simple but I really don't understand how to so I hope you can guide me through on what to do/read.
Use SequentialExecutor
"This executor will only run one task instance at a time, can be used for debugging. It is also the only executor that can be used with sqlite since sqlite doesn’t support multiple connections." airflow documentation
You just didn't need to change to LocalExecutor, change it back to SequentialExecutor, change sql_alchemy_conn to point to sqlite:////home/myName/Programs/sqlite3/DatabaseName.db and stop airflow services (webserver, scheduler).
Execute airflow initdb then start up the services again.
Hopefully that works.

Virtualenv is not allowing me to use ImageHorizonLibrary and SwingLibrary in robotframework at the same time

My bash_profile is set to the following:
export PATH=/Users/nimam/jython2.7.0/bin:/opt/local/bin:/opt/local/sbin::/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I need to include jython as I am running the swinglibrary for the robotframework, but I would like to include ImageHorizonLibrary as well. However, i am currently not able to run the ImageHorizonLibrary. I get the following error.
[ ERROR ] Error in file '/Users/nimam/swinglibrary-demo/read_attributes.robot': Importing test library 'ImageHorizonLibrary' failed: ImportError: No module named ImageHorizonLibrary
Traceback (most recent call last):
None
PYTHONPATH:
/Users/nimam/jython2.7.0/bin
/Users/nimam/jython2.7.0/Lib
__classpath__
__pyclasspath__/
/Users/nimam/jython2.7.0/Lib/site-packages
CLASSPATH:
/Users/nimam/jython2.7.0/jython.jar
Rotarran-2.0.8-standalone.jar
If I comment out the export PATH in the bash_profile, it recognizes the ImageHorizonLibrary but not the SwingLibrary. I get the following error:
[ ERROR ] Error in file '/Users/nimam/swinglibrary-demo/read_attributes.robot': Importing test library 'SwingLibrary' failed: ImportError: No module named SwingLibrary
Traceback (most recent call last):
None
PYTHONPATH:
/usr/local/bin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Users/nimam/Library/Python/2.7/lib/python/site-packages
/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
I have a feeling I can solve this by playing around with the virtualenv. Please let me know if there is a way I can run both libraries at the same time.