- Install NCCL
git clone https://github.com/NVIDIA/nccl.git /home/ubuntu/nccl --recursive
make CUDA_HOME=/usr/local/cuda -j4
make install
print("Hello World!") | |
let airports: [String : String] = [ | |
"SFO" : "San Francisco", | |
"BOS" : "Boston" | |
] | |
for (code, name) in airports { | |
print("\(code) : \(name)") | |
} |
# model settings | |
model = dict( | |
type='FasterRCNN', | |
pretrained='modelzoo://resnet101', | |
backbone=dict( | |
type='ResNet', | |
depth=101, | |
num_stages=4, | |
out_indices=(0, 1, 2, 3), | |
frozen_stages=1, |
model { | |
faster_rcnn { | |
num_classes: 6 | |
image_resizer { | |
keep_aspect_ratio_resizer { | |
min_dimension: 500 | |
max_dimension: 500 | |
} | |
} | |
feature_extractor { |
''' | |
Requirements: | |
pip3 install elasticsearch | |
pip3 install certifi | |
''' | |
from elasticsearch import Elasticsearch | |
import certifi | |
import re |
import re | |
def extract_url(cid, id32): | |
chop_id = '/'.join(re.findall('..', '{:0>10}'.format(cid))[0:4]) | |
size = '240' | |
return (str(cid), 'https://t3.ftcdn.net/jpg/{}/{}_F_{}_{}_NW.jpg'.format(chop_id, size, cid, id32)) | |
def extract_tags(rdd_record): | |
j = json.loads(rdd_record) | |
tags = [x.split('^')[0] for x in j['k']['eksrg']] |
# Copy files from one directory to another directory in the same S3 bucket | |
all_tsvs = set([line.rstrip('\n') for line in open('all_files.log')]) | |
processed_tsvs = set([line.rstrip('\n') for line in open('processed.log')]) | |
to_do_tsvs = [elem.split('s3://psriniva/')[-1] for elem in list(all_tsvs - processed_tsvs)] | |
to_do_tsvs[-1] | |
import boto3 |
from random import choice | |
import string | |
def compress_string(s): | |
if len(s) < 3: | |
return 0 | |
max_len = len(s) - 2 | |
str_list = [] | |
for num in range(len(s), 2, -1): | |
for i in range(1, len(s) - num): |
class Solution: | |
def helper(self, candidates, target, curr_comb, result, curr_id, curr_sum): | |
if curr_sum >= target: | |
if curr_sum == target: | |
result.append(curr_comb) | |
return | |
for i in range(curr_id, len(candidates)): | |
curr_comb.append(candidates[i]) | |
self.helper(candidates, target, curr_comb, result, i, curr_sum + candidates[i]) |
def maximum_under_budget_1d(array, budget): | |
st, max_sum, max_len = 0, 0, 0 | |
#print(array) | |
for ed in range(len(array)): | |
max_sum += array[ed] | |
while max_sum > budget and st <= ed: | |
max_sum -= array[st] | |
st += 1 | |
max_len = max(max_len, ed - st + 1) | |
return max_len |