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
device = next(model.parameters()).device |
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 | |
import tarfile | |
from tqdm.auto import tqdm | |
tar_file = "/data/images.tar.gz" | |
extract_to = "/data/" | |
files = {} | |
with tarfile.open(tar_file, "r:gz") as file: |
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
kill $(ps aux | grep '[p]ython csp_build.py' | awk '{print $2}') |
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 multiprocessing import Pool | |
with Pool(processes=10) as pool: | |
for _ in tqdm(pool.imap_unordered(parse_row, df.itertuples(name=None)), total=len(df)): | |
pass |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Prepare | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install build-essential cmake unzip pkg-config | |
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev | |
sudo apt-get install libjasper-dev | |
# If previous line doesn't work | |
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" | |
sudo apt update |
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
class SaveOutput: | |
def __init__(self): | |
self.outputs = [] | |
def __call__(self, module, module_in, module_out): | |
self.outputs.append(module_out) | |
def clear(self): | |
self.outputs = [] | |
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
{ | |
"window.zoomLevel": 0, | |
"editor.tabSize": 4, | |
"editor.insertSpaces": true, | |
"editor.detectIndentation": false, | |
"editor.rulers": [ 80 ], | |
"terminal.integrated.inheritEnv": false, | |
"python.dataScience.sendSelectionToInteractiveWindow": true, | |
"files.trimTrailingWhitespace": true, | |
"python.linting.flake8Enabled": true, |
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
#!/bin/sh | |
tmux new-session -d -s watch 'exec watch -n 1 nvidia-smi' | |
tmux rename-window 'Watch' | |
tmux select-window -t watch:0 | |
tmux split-window -v 'exec htop' | |
tmux resize-pane -y 8 |
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
// This script makes it possible to resume cells output receiving after a notebook reloads. | |
// Works even when the notebook is open in other browser (output will be shown in all opened windows). | |
// Works with keras and tqdm (not with tqdm_notebook). | |
// | |
// Add this code into your ~/.jupyter/custom/custom.js | |
define([ | |
'base/js/namespace', | |
'base/js/promises' | |
], function(Jupyter, promises) { |
NewerOlder