This gist contains my development environment settings. The idea is that I should be able to reproduce my development environment from scratch.
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
| echo "Installing base packages" | |
| conda install \ | |
| -c conda-forge \ | |
| -y \ | |
| -q \ | |
| dask-yarn>=0.7.0 \ | |
| pyarrow \ | |
| s3fs \ | |
| conda-pack \ | |
| tornado=5 \ |
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 argparse | |
| import torch.multiprocessing as mp | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| import torch.optim as optim | |
| from torchvision import datasets, transforms | |
| import torch.utils.data.distributed | |
| import horovod.torch as hvd | |
| # Training settings |
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 rich.console import Console | |
| from rich.table import Column, Table | |
| console = Console() | |
| table = Table(show_header=True, header_style="bold magenta") | |
| table.add_column("Model") | |
| table.add_column("GPU", justify="right") | |
| table.add_column("💾 (w/o MP)", justify="right") | |
| table.add_column("💾 (w/ MP)", justify="right") |
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
| #!/usr/bin/env python | |
| import os | |
| import torch | |
| import torch.distributed as dist | |
| from torch.multiprocessing import Process | |
| def run(rank, size): | |
| """ Distributed function to be implemented later. """ | |
| # collective ops are performed against groups | |
| group = dist.new_group([0, 1, 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
| # NEW additional imports | |
| import torch.distributed as dist | |
| import torch.multiprocessing as mp | |
| from torch.nn.parallel import DistributedDataParallel | |
| from torch.utils.data.distributed import DistributedSampler | |
| # NEW init_process method | |
| def init_process(rank, size, backend='gloo'): | |
| """ Initialize the distributed environment. """ | |
| os.environ['MASTER_ADDR'] = '127.0.0.1' |
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
| self.train() | |
| X = torch.tensor(X, dtype=torch.float32) | |
| y = torch.tensor(y, dtype=torch.float32) | |
| optimizer = torch.optim.Adam(self.parameters(), lr=self.max_lr) | |
| scheduler = torch.optim.lr_scheduler.OneCycleLR( | |
| optimizer, self.max_lr, | |
| cycle_momentum=False, | |
| epochs=self.n_epochs, | |
| steps_per_epoch=int(np.ceil(len(X) / self.batch_size)), |
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 pandas as pd | |
| from pathlib import Path | |
| path = Path('rossmann') | |
| train_df = pd.read_pickle('/mnt/rossman-fastai-sample/train_clean').drop(['index', 'Date'], axis='columns') | |
| test_df = pd.read_pickle('/mnt/rossman-fastai-sample/test_clean') | |
| from sklearn.preprocessing import OneHotEncoder, LabelEncoder | |
| from sklearn.pipeline import FeatureUnion, Pipeline | |
| import numpy as np |
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
| NAME READY STATUS RESTARTS AGE | |
| pod/admission-webhook-bootstrap-stateful-set-0 1/1 Running 0 26m | |
| pod/admission-webhook-deployment-78969d856-dgxrz 1/1 Running 0 25m | |
| pod/application-controller-stateful-set-0 1/1 Running 0 26m | |
| pod/argo-ui-55b859f7d7-9m7g7 1/1 Running 0 26m | |
| pod/basic-auth-7489dc8bd4-scsg4 1/1 Running 0 26m | |
| pod/basic-auth-login-5f77644b79-s8drd 1/1 Running 0 26m | |
| pod/centraldashboard-7f68f6bf7b-5g9xc 1/1 Running 0 26m | |
| pod/cloud-endpoints-controller-77756cbf84-4pkkr 1/1 Running 0 26m | |
| pod/jupyter-web-app-deployment-5b56748d57-q4q7g 1/1 Running 0 26m |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.