ju-ki / my_pipeline

0 stars 0 forks source link

my_pipeline

今までのコンペで使用してきたコードを集めたもの

How to install

pip install git+https://github.com/ju-ki/my_pipeline

Set up environment for tabular competition

from jukijuki.utils.logger import Logger
from jukijuki.utils.timer import Timer
from jukijuki.utils.util import create_folder, seed_everything
from jukijuki.validation.SturgesRuleStratifiedKFold import sturges_skf
from jukijuki.tabular.util import AbstractBaseBlock, WrapperBlock, run_blocks
from jukijuki.tabular.feature_engine import LabelEncodingBlock, CountEncodingBlock, AggregationBlock, OneHotEncodingBlock, CrossCategoricalFeatureBlock
from jukijuki.gb_model.model_lgbm import MyLGBMModel
from jukijuki.gb_model.model_xgboost import MyXGBModel
from jukijuki.gb_model.model_cat import MyCatModel

class Config:
    competition_name = "hogehoge"
    exp_name = "hoge"
    target_col = "target"
    seed = 42
    n_fold = 5

create_folder(Config)
seed_everything(Config.seed)
logger = Logger(Config.log_dir, Config.exp_name)

Set up environment for image competition

from jukijuki.image.util import get_file_path
from jukijuki.utils.timer import Timer
from jukijuki.utils.logger import Logger
from jukijuki.utils.EarlyStopping import EarlyStopping
from jukijuki.utils.util import create_folder, seed_everything, get_device
from jukijuki.pytorch_model.util import get_optimizer, get_scheduler

class Config:
    apex=False
    competition_name = "hogehoge"
    exp_name = "hoge"
    target_col = "target"
    batch_size = 32
    num_workers = 4
    size = 224
    epochs = 8
    model_name = "resnet34d"
    optimizer_name = "AdamW"
    scheduler = "CosineAnnealingLR"
    T_max = epochs
    lr = 1e-4
    min_lr = 1e-6
    weight_decay = 1e-6
    gradient_accumulation_steps=1
    max_grad_norm=1000
    n_fold = 5
    trn_fold = [0, 1, 2, ,3, 4]
    seed = 42
    target_size = 1
    TRAIN = True
    INFERENCE = False
    DEBUG = True

create_folder(Config)
seed_everything(Config.seed)
device = get_device()
logger = Logger(Config.log_dir, Config.exp_name)

Set up environment for nlp competition

from jukijuki.nlp.util import get_tokenizer, get_max_lengths
from jukijuki.utils.timer import Timer
from jukijuki.utils.logger import Logger
from jukijuki.utils.EarlyStopping import EarlyStopping
from jukijuki.utils.util import create_folder, seed_everything, get_device
from jukijuki.nlp.pooler import AttentionPoolingV1, MeanPoolingV1
from jukijuki.pytorch_model.util import get_optimizer, get_scheduler

class Config:
    apex=False
    competition_name = "hogehoge"
    exp_name = "hoge"
    target_col = "target"
    sentence_col = "hoge"
    batch_size = 32
    num_workers = 4
    max_len = 250
    epochs = 8
    model_name = "roberta-base"
    pool_name = "attention"
    optimizer_name = "AdamW"
    scheduler = "cosine"
    T_max = epochs
    lr = 1e-4
    min_lr = 1e-6
    weight_decay = 1e-6
    gradient_accumulation_steps=1
    max_grad_norm=1000
    n_fold = 5
    trn_fold = [0, 1, 2, 3, 4]
    seed = 42
    target_size = 1
    batch_scheduler = True
    TRAIN = True
    INFERENCE = False
    DEBUG = True

create_folder(Config)
seed_everything(Config.seed)
device = get_device()
tokenizer = get_tokenizer(Config)
logger = Logger(Config.log_dir, Config.exp_name)