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
| Calendar: https://iclr.cc/virtual/calendar.html#tab-calendar | |
| Paper search: https://iclr.cc/virtual/papers.html?filter=keywords | |
| Papers: | |
| 1. Title: | |
| Tree-Structured Attention with Hierarchical Accumulation | |
| Authority: | |
| Richard Socher | |
| Url: | |
| https://iclr.cc/virtual/poster_HJxK5pEYvr.html |
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
| # Source: https://github.com/opencv/openvino_training_extensions/blob/develop/pytorch_toolkit/nncf/examples/common/utils.py#L86 | |
| import tarfile | |
| from pathlib import Path | |
| def create_code_snapshot(root, dst_path, extensions=(".py", ".json", ".cpp", ".cu")): | |
| """Creates tarball with the source code""" | |
| with tarfile.open(str(dst_path), "w:gz") as tar: | |
| for path in Path(root).rglob("*"): |
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 nvidia.dali.plugin.pytorch import DALIGenericIterator | |
| pipe = ExternalSourcePipeline(data_iterator=iterator, batch_size=16, num_threads=2, device_id=0) | |
| pipe.build() | |
| # first parameter is list of pipelines to run | |
| # second pipeline is output_map that maps consecutive outputs to | |
| # corresponding names | |
| # last parameter is the number of iterations - number of examples you | |
| # want to iterate on |
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
| eii = ExternalInputIterator(batch_size=16, | |
| data_file=processed_data_file, | |
| image_dir=images_directory) | |
| iterator = iter(eii) | |
| class ExternalSourcePipeline(Pipeline): | |
| def __init__(self, data_iterator, batch_size, num_threads, device_id): | |
| super(ExternalSourcePipeline, self).__init__(batch_size, | |
| num_threads, | |
| device_id, |
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 types | |
| import numpy as np | |
| import collections | |
| import pandas as pd | |
| from random import shuffle | |
| import nvidia.dali.ops as ops | |
| import nvidia.dali.types as types | |
| from nvidia.dali.pipeline import Pipeline |
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 os import listdir | |
| from os.path import isfile, join | |
| images_directory = './flower_data/flower_data_flat' | |
| # read names of all image files | |
| image_files = [f for f in listdir(image_dir) if isfile(join(image_dir, f))] | |
| # we create a data frame with the image names and dummy labels - label_1, label_2 | |
| data = pd.DataFrame(list(zip(image_files, | |
| list(range(len(image_files))), |
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
| $ wget -cq https://s3.amazonaws.com/content.udacity-data.com/courses/nd188/flower_data.zip \ | |
| && unzip -qq flower_data.zip \ | |
| && mkdir -p ./flower_data/flower_data_flat \ | |
| && find ./flower_data/train -mindepth 2 -type f -exec mv -t ./flower_data/flower_data_flat -i '{}' + |
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
| # Find out the cuda version so that we install appropriate DALI binaries | |
| # Find installation instructions at | |
| # https://github.com/NVIDIA/DALI#installing-prebuilt-dali-packages | |
| $ nvcc --version | |
| # sample output | |
| nvcc: NVIDIA (R) Cuda compiler driver | |
| Copyright (c) 2005-2018 NVIDIA Corporation | |
| Built on Sat_Aug_25_21:08:01_CDT_2018 |
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 torchvision import transforms | |
| def get_image_transforms() -> transforms.Compose: | |
| """ | |
| These transformations meant for data augmentation are a bottleneck | |
| since all the operations are done on CPU and then the tensors are | |
| copied to the GPU device. | |
| """ | |
| return transforms.Compose([ | |
| transforms.RandomSizedCrop(224), |
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
| def logsigsoftmax(logits): | |
| """ | |
| Computes sigsoftmax from the paper - https://arxiv.org/pdf/1805.10829.pdf | |
| """ | |
| max_values = torch.max(logits, 1, keepdim = True)[0] | |
| exp_logits_sigmoided = torch.exp(logits - max_values) * torch.sigmoid(logits) | |
| sum_exp_logits_sigmoided = exp_logits_sigmoided.sum(1, keepdim = True) | |
| log_probs = logits - max_values + torch.log(torch.sigmoid(logits)) - torch.log(sum_exp_logits_sigmoided) | |
| return log_probs |