This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install parlai | |
# download hash file from https://drive.google.com/file/d/1u_u6MPx1i3AVuw0CkjyAC8udvcid3vX_/view?usp=sharing | |
from parlai.core.build_data import download_multiprocess | |
image_path = '/mnt/data/dataset/yfcc' | |
with open(f'/home/franklin/fewshot/dataset/yfcc-100m/yfcc100m_hash') as f: | |
data= f.readlines() | |
print(f'number of images: {len(data)}') | |
#data = data[:1000] | |
n_img = len(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<!-- Generated by: TmTheme-Editor --> | |
<!-- ============================================ --> | |
<!-- app: http://tmtheme-editor.herokuapp.com --> | |
<!-- code: https://github.com/aziz/tmTheme-Editor --> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Visual Studio</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NEW | |
scaler = torch.cuda.amp.GradScaler() | |
for epoch in range(self.n_epochs): | |
for i, (X_batch, y_batch) in enumerate(batches): | |
X_batch = X_batch.cuda() | |
y_batch = y_batch.cuda() | |
optimizer.zero_grad() | |
# NEW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Check my git repo styleMix | |
import torch.nn as nn | |
from utils import Model_type, euclidean_dist | |
from torch.nn import functional as F | |
import torch | |
from pytorch_lightning.core.lightning import LightningModule | |
import numpy as np | |
from collections import OrderedDict | |
from time import time | |
from utils import count_acc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn import datasets | |
from sklearn.manifold import TSNE | |
def get_data(): | |
digits = datasets.load_digits(n_class=10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path as osp | |
dataset_dir = '/home/frankllin/Downloads/DomainNet' | |
split_dir = osp.join(dataset_dir, 'splits_mini') | |
image_size = 84 | |
from PIL import Image | |
import h5py | |
import numpy as np | |
from tqdm import tqdm | |
def store_many_hdf5(h5file, images, labels): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |