Setting up Python venv for Ansible
In this quick tutorial we'll set up python on a mac os x in order to run ansble from the current folder.
In this quick tutorial we'll set up python on a mac os x in order to run ansble from the current folder.
I recently wrote this utility... a mere function, really, to resize and scale a python image at the center. This way, I don't have to worry about how my images are being fed into an AI pipeline, if they all get scaled and cropped the same.
Additionally, while previously I used bash to rename files in a folder to sequential names such as 1.jpg , the current implementation ignores filenames, which saves me time when massaging the data.
By Alexander Van de Kleut. But you may also want to read the VAE by Reza Kalantar.
Motivation
The problem was naming a local module with the same name as an imported module. I had a file called ./tokenize.py and moving it to ./run_tokenize.py solved the problem.
If you see an error similar to this one:
RuntimeError: CUDA out of memory. Tried to allocate 11.88 MiB (GPU 4; 15.75 GiB total capacity; 10.50 GiB already allocated; 1.88 MiB free; 3.03 GiB cached)
then, try reducing the batch size.
train_loader = DataLoader(
train_dataset,
shuffle=False,
pin_memory=False,
batch_size=2, # was: 16
num_workers=12,
)ML is taking the world over by storm in 2023. Here is an easy-to follow tutorial in pure python that explains the basics.