Skip to content

Instantly share code, notes, and snippets.

View Chris-hughes10's full-sized avatar

Chris Hughes Chris-hughes10

View GitHub Profile
@Chris-hughes10
Chris-hughes10 / timm.ipynb
Last active April 23, 2024 07:51
timm.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Chris-hughes10
Chris-hughes10 / EfficientDet Pytorch-lightning with EfficientNet v2 backbone Blog Post.ipynb
Last active April 22, 2024 08:57
EfficientDet Pytorch-lightning with EfficientNet v2 backbone Blog Post.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Chris-hughes10
Chris-hughes10 / train.py
Created January 27, 2022 16:58
timm blog - Training script using timm and PyTorch-accelerated
import argparse
from pathlib import Path
import timm
import timm.data
import timm.loss
import timm.optim
import timm.utils
import torch
import torchmetrics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Chris-hughes10
Chris-hughes10 / Recommender blog post.ipynb
Created December 9, 2021 09:19
Comparing matrix factorixation with transformers using pytorch-accelerated blog post.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Chris-hughes10
Chris-hughes10 / install-AzCopy.sh
Created June 9, 2022 09:27 — forked from aessing/install-AzCopy.sh
Install AzCopy on Linux
#!/bin/bash
# =============================================================================
# Install AzCopy on Linux
# https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10
# https://github.com/Azure/azure-storage-azcopy
# -----------------------------------------------------------------------------
# Developer.......: Andre Essing (https://www.andre-essing.de/)
# (https://github.com/aessing)
# (https://twitter.com/aessing)
# (https://www.linkedin.com/in/aessing/)
@Chris-hughes10
Chris-hughes10 / parser_image_name.py
Created January 27, 2022 14:53
timm blog - custom parser
from pathlib import Path
from timm.data.parsers.parser import Parser
class ParserImageName(Parser):
def __init__(self, root, class_to_idx=None):
super().__init__()
self.root = Path(root)
@Chris-hughes10
Chris-hughes10 / effdet_dataset.py
Last active December 28, 2021 09:42
Effdet_blog_dataset
from torch.utils.data import Dataset
class EfficientDetDataset(Dataset):
def __init__(
self, dataset_adaptor, transforms=get_valid_transforms()
):
self.ds = dataset_adaptor
self.transforms = transforms
def __getitem__(self, index):
@Chris-hughes10
Chris-hughes10 / recommender_metrics_callback.py
Created December 9, 2021 07:43
Recommender Blog: Torchmetrics recommender callback
from pytorch_accelerated.callbacks import TrainerCallback
import torchmetrics
class RecommenderMetricsCallback(TrainerCallback):
def __init__(self):
self.metrics = torchmetrics.MetricCollection(
{
"mse": torchmetrics.MeanSquaredError(),
"mae": torchmetrics.MeanAbsoluteError(),
}
@Chris-hughes10
Chris-hughes10 / mf_model.py
Created December 9, 2021 07:39
Recommender blog: matrix factorization model
import torch
from torch import nn
class MfDotBias(nn.Module):
def __init__(
self, n_factors, n_users, n_items, ratings_range=None, use_biases=True
):
super().__init__()
self.bias = use_biases