All minor issues I've faced and their solutions. Also contains things that I usually forget.
To select Device automatically
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
TQDM iteration prints on new line. To fix this change the import statement to
from tqdm.auto import tqdm
To change figure size
fig = plt.figure(figsize(width, height))
Subplots, axis removal, title, plotting
fig.add_subplot(MAX_ROWS, MAX_COLUMNS, index)
plt.axis("off")
plt.title("Title for the subplot")
plt.imshow(image_to_be_plotted)
To download dataset onto colab follow the steps given below :
-
Go to your kaggle account and click on the create new API token button and save the kaggle.json file created.
-
Run the code given below in a cell on your notebook and upload the kaggle.json file when promted to.
!pip install -q kaggle
from google.colab import files
files.upload()
!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
# dataset-link example : dhruvildave/spotify-charts
!kaggle datasets download -d <dataset-link>
!unzip dataset.zip -d dataset