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
[Unit] | |
Description=MLFlow Server | |
[Service] | |
Type=simple | |
ExecStart=/bin/bash -c 'PATH=/home/<username>/miniconda3/bin/:$PATH exec mlflow server --backend-store-uri postgresql://mlflow:mlflow@localhost/mlflow --default-artifact-root file:/home/andreas/mlruns -h 0.0.0.0 -p 8000' | |
User=<user> | |
Group=<group> |
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 ResNet(nn.Module): | |
def __init__( | |
self, | |
block: Type[Union[BasicBlock, Bottleneck]], | |
layers: List[int], | |
num_classes: int = 1000, | |
zero_init_residual: bool = False, | |
groups: int = 1, | |
width_per_group: int = 64, | |
replace_stride_with_dilation: Optional[List[bool]] = None, |
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 BasicBlock(nn.Module): | |
expansion: int = 1 | |
def __init__( | |
self, | |
inplanes: int, | |
planes: int, | |
stride: int = 1, | |
downsample: Optional[nn.Module] = None, | |
groups: int = 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
def conv3x3( | |
in_planes: int, out_planes: int, stride: int = 1, groups: int = 1, dilation: int = 1 | |
) -> nn.Conv2d: | |
"""3x3 convolution with padding""" | |
return nn.Conv2d( | |
in_planes, | |
out_planes, | |
kernel_size=3, | |
stride=stride, | |
padding=dilation, |
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 typing import Type, Any, Callable, Union, List, Optional | |
import torch | |
from torch import nn | |
from torch import Tensor |
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 datetime import datetime, timedelta | |
import airflow | |
from airflow import DAG | |
from custom import MySqlToPostgreOperator | |
dag = DAG( | |
dag_id="a_job_near_rt", | |
start_date=datetime.now() - timedelta(hours=1), | |
schedule_interval="* * * * *", | |
concurrency=100 |
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 datetime import datetime, timedelta | |
import airflow | |
from airflow import DAG | |
from custom import MySqlToPostgreOperator | |
dag = DAG( | |
dag_id="job_trial_user", | |
start_date=datetime.today() - timedelta(days=1), | |
schedule_interval="0 */4 * * *", | |
concurrency=100 |
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 airflow.hooks.base import BaseHook | |
from airflow.hooks.mysql_hook import MySqlHook | |
from airflow.providers.postgres.hooks.postgres import PostgresHook | |
from airflow.models.baseoperator import BaseOperator | |
from airflow.utils.decorators import apply_defaults | |
class MySqlToPostgreOperator(BaseOperator): | |
@apply_defaults |
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 datetime import datetime, timedelta | |
import airflow | |
from airflow import DAG | |
from airflow.operators.bash import BashOperator | |
dag = DAG( | |
dag_id="get_instance_v6", | |
start_date=datetime.today() - timedelta(minutes=60), | |
schedule_interval="*/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
# Training Routine | |
# set 100 epoch | |
for epoch in range(1, 101): | |
train_loss = 0 | |
test_loss = 0 | |
model.train() | |
train_gen = DataLoader(dataset_train, batch_size=2) | |
for batch_index, (x, y) in enumerate(train_gen, 1): | |
NewerOlder