import torch
import torchvision.models as models
model = models.densenet121(pretrained=True)
x = torch.randn((1, 3, 224, 224), requires_grad=True)
with torch.autograd.profiler.profile(use_cuda=True) as prof:
model(x)
This file contains 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
#!/usr/bin/env python | |
__author__ = 'Kevin Warrick' | |
__email__ = 'kwarrick@uga.edu, abulka@gmail.com' | |
__version__ = '2.0.0' | |
import pickle | |
from collections import namedtuple | |
from functools import wraps | |
import inspect | |
from icecream import ic |
This file contains 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
const source = 'http://ncov.mohw.go.kr' | |
let webView = new WebView() | |
await webView.loadURL(source) | |
let covid = await webView.evaluateJavaScript(` | |
const baseSelector = 'div.mainlive_container div.liveboard_layout ' | |
let date = document.querySelector(baseSelector + 'h2 span.livedate').innerText | |
let domestic = document.querySelector(baseSelector + 'div.liveNum_today_new ul li:nth-child(1) span.data').innerText | |
let overseas = document.querySelector(baseSelector + 'div.liveNum_today_new ul li:nth-child(2) span.data').innerText | |
This file contains 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 f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor: | |
'''Calculate F1 score. Can work with gpu tensors | |
The original implmentation is written by Michal Haltuf on Kaggle. | |
Returns | |
------- | |
torch.Tensor | |
`ndim` == 1. 0 <= val <= 1 | |
- Curriculum Learning - When training machine learning models, start with easier subtasks and gradually increase the difficulty level of the tasks.
- Motivation comes from the observation that humans and animals seem to learn better when trained with a curriculum like a strategy.
- Link to the paper.
This file contains 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
#! /bin/bash | |
sudo aptitude update | |
sudo aptitude full-upgrade -y | |
sudo reboot | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo aptitude update | |
sudo aptitude install -y linux-image-extra-virtual | |
sudo aptitude install -y cuda |
This file contains 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
r = requests.get(file_url) | |
size = int(r.headers['Content-Length'].strip()) | |
self.bytes = 0 | |
widgets = [name, ": ", Bar(marker="|", left="[", right=" "), | |
Percentage(), " ", FileTransferSpeed(), "] ", | |
self, | |
" of {0}MB".format(str(round(size / 1024 / 1024, 2))[:4])] | |
pbar = ProgressBar(widgets=widgets, maxval=size).start() | |
file = [] | |
for buf in r.iter_content(1024): |