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 torch | |
import time | |
from bitsandbytes.nn import Params4bit | |
from torchao.dtypes.nf4tensor import NF4Tensor, linear_nf4, to_nf4 | |
import bitsandbytes as bnb | |
import pandas as pd | |
def benchmark_forward_pass(batch_size, hidden_dim, method='nf4tensor', num_iters=100): | |
"""Run forward pass benchmark for given parameters.""" | |
device = torch.device('cuda:0') |
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
hardstatus alwayslastline | |
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' | |
# huge scrollback buffer | |
defscrollback 5000 | |
# no welcome message | |
startup_message off | |
# 256 colors |
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
""" Calibrated Classifier Model: To calibrate predictions using Platt's scaling, Isotonic Regression or Splines | |
""" | |
import copy | |
import datatable as dt | |
from h2oaicore.mojo import MojoWriter, MojoFrame | |
from h2oaicore.systemutils import config | |
from h2oaicore.models import CustomModel, LightGBMModel | |
from sklearn.preprocessing import LabelEncoder | |
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
""" Calibrated Classifier Model: To calibrate predictions using Platt's scaling, Isotonic Regression or Splines | |
""" | |
import copy | |
import datatable as dt | |
from h2oaicore.mojo import MojoWriter, MojoFrame | |
from h2oaicore.systemutils import config | |
from h2oaicore.models import CustomModel, LightGBMModel | |
from sklearn.preprocessing import LabelEncoder | |
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 # plays Actual Expected Ratio Dif | |
Kerryon Johnson 118 5.432 3.755 1.446 1.677 | |
Kenneth Dixon 60 5.550 4.201 1.321 1.349 | |
Saquon Barkley 261 5.008 3.738 1.340 1.270 | |
Nick Chubb 190 5.184 3.931 1.319 1.253 | |
Derrick Henry 200 4.825 3.695 1.306 1.130 | |
Jordan Wilkins 60 5.600 4.558 1.229 1.042 | |
Aaron Jones 132 5.485 4.465 1.228 1.020 | |
Zach Zenner 55 4.818 3.845 1.253 0.973 | |
Phillip Lindsay 189 5.466 4.510 1.212 0.955 |
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 # plays Actual Expected Ratio Dif | |
Kerryon Johnson 118 5.432 3.755 1.446 1.677 | |
Kenneth Dixon 60 5.550 4.201 1.321 1.349 | |
Saquon Barkley 261 5.008 3.738 1.340 1.270 | |
Nick Chubb 190 5.184 3.931 1.319 1.253 | |
Derrick Henry 200 4.825 3.695 1.306 1.130 | |
Jordan Wilkins 60 5.600 4.558 1.229 1.042 | |
Aaron Jones 132 5.485 4.465 1.228 1.020 | |
Zach Zenner 55 4.818 3.845 1.253 0.973 | |
Phillip Lindsay 189 5.466 4.510 1.212 0.955 |
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 joblib import Parallel, delayed | |
import multiprocessing | |
import pandas as pd | |
import time | |
def applyParallel(dfGrouped, func): | |
retLst = Parallel(n_jobs=multiprocessing.cpu_count())(delayed(func)(group) for name, group in dfGrouped) | |
return pd.concat(retLst) | |
def myfunc(df) | |
return df | |
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
#https://github.com/qubvel/ttach | |
import ttach as tta | |
transforms = tta.Compose( | |
[ | |
tta.HorizontalFlip(), | |
tta.VerticalFlip(), | |
# tta.Rotate90(angles=[0, 180]), | |
# tta.Scale(scales=[1, 2, 4]), | |
# tta.Multiply(factors=[0.9, 1, 1.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
from sklearn.base import BaseEstimator, TransformerMixin | |
from pandas.api.types import CategoricalDtype | |
import pandas as pd | |
class DummyEncoder(BaseEstimator, TransformerMixin): | |
def __init__(self, min_frequency=1, dummy_na=True): | |
self.min_frequency = min_frequency | |
self.dummy_na = dummy_na | |
self.categories = dict() |
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 numpy as np | |
x = np.array([525., 300., 450., 300., 400., 500., 550., 125., 300., 400., 500., 550.]) | |
y = np.array([250., 225., 275., 350., 325., 375., 450., 400., 500., 550., 600., 525.]) | |
data = np.array([x, y]) | |
model = analyze(data) |
NewerOlder