Skip to content

Instantly share code, notes, and snippets.

@yosoyjay
yosoyjay / get-pkeys.sh
Created January 4, 2024 22:18
Print pkeys on Azure
#!/bin/sh
cat /sys/class/infiniband/mlx5_ib*/ports/1/pkeys/*|grep -v 0x0000 | sort | uniq -c
#!/bin/bash
set -e
NVME_DISKS_NAME=`ls /dev/nvme*n1`
NVME_DISKS=`ls -latr /dev/nvme*n1 | wc -l`
echo "Number of NVMe Disks: $NVME_DISKS"
if [ "$NVME_DISKS" == "0" ]
#!python
"""Collect distribution of a directory of images and write to text file."""
import logging
from pathlib import Path
import numpy as np
from PIL import Image
logging.basicConfig(level=logging.INFO)
#!/bin/bash
# Script to partion a drive, format as xfs, add fstab entry, create mount point, and mount it (all).
#
# Notes:
# - Must be run with sudo
# - Assumes all drive is in a single logical partition
# - Mounts to /data
set -e
#!/bin/bash
# Script to download, unzip, and run organization script on ImageNet ILSVRC from Kaggle.
#
# Assumes:
# - You have installed the Kaggle CLI tools (i.e. `pip install kaggle`
# - You have appropriate file located at `~/.kaggle/kaggle.json` with permissions of 600
# - You have adequate disk space (>= 1.5 TiB)
#
# Time and space notes (from my experience on cloud VMs, YMMV):
# - Downloads takes ~15 mins
k='Akashiwo', v=0.9230769230769231
k='Alexandrium_singlet', v=0.75
k='Amy_Gony_Protoc', v=0.7692307692307693
k='Asterionellopsis', v=0.5576923076923077
k='Bacteriastrum', v=0.7884615384615384
k='Centric', v=0.8076923076923077
k='Ceratium', v=0.34615384615384615
k='Chaetoceros', v=0.6923076923076923
k='Ciliates', v=0.7307692307692307
k='Coccolithophore', v=0.7674418604651163
In [4]: model = tf.keras.models.load_model('scwharf-ifcb-xception')
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
<ipython-input-4-5509cb97abce> in <module>
----> 1 model = tf.keras.models.load_model('scwharf-ifcb-xception')
~/mambaforge/envs/ifcb-updater/lib/python3.9/site-packages/tensorflow/python/keras/saving/save.py in load_model(filepath, custom_objects, compile, options)
210 if isinstance(filepath, six.string_types):
211 loader_impl.parse_saved_model(filepath)
--> 212 return saved_model_load.load(filepath, compile, options)
import queue
import threading
nthreads = 2 # test and play with different values here to see how fast you can get it
# setup up N workers
for i in range(nthreads):
worker = threading.Thread(
target=make_chunks_and_plot,
args=(queue,),
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.