Skip to content

Instantly share code, notes, and snippets.

View tcapelle's full-sized avatar
😄
happy

Thomas Capelle tcapelle

😄
happy
View GitHub Profile
@tcapelle
tcapelle / useful_stuff.md
Last active November 8, 2023 16:59
Useful Command and more

Linux

Setup

When setting up a fresh VM.

sudo apt update
sudo apt-get install vim tmux wget
@tcapelle
tcapelle / wine_list.md
Last active October 26, 2023 15:41
Wine List in France

My Personal Top Wines: by Region

This is an arbitrary good list of wines I like, don't be offended if your favorite wine is not there. I have limited tasting time, and have mostly choose little family owned producers

Everything here is Organic, most are biodynamic and some are natural.

I have visited most of the winerys myself, and now I order directly from them or by my local wine-shop that actually helps me find more wine of this quality.

Loire

Probably my fav white wine region, I love the floral and sometimes minerality of these wines. There is always a good reason to open any of these bottles. It is also a very beautiful region to visit where you find accomodation on old castles like Chteau de Beaujeu.

import wandb
from wandb import Api
api = Api()
ENTITY = "fastai"
PROJECT = "fine_tune_timm"
project = api.project(PROJECT, entity=ENTITY)
sweeps = project.sweeps()
import os
import openai
from rich.console import Console
console = Console()
openai.api_key = os.getenv("OPENAI_API_KEY")
history = [{"role": "system", "content": "You are a helpful assistant."},]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import wandb
import timm
import argparse
from fastai.vision.all import *
from fastai.callback.wandb import WandbCallback
from torchvision import models
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=64)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tcapelle
tcapelle / intro.md
Last active December 8, 2021 14:38
Running the benchmark on your Nvidia equipped laptop

Setup NGC Docker

you will need to setup docker with nvidia runtime, containers

  • Install docker and nvidia-docker:
sudo apt-get install -y docker nvidia-container-toolkit
@tcapelle
tcapelle / seg_mixer.py
Last active September 7, 2021 12:32
A segmentation model using an MLP mixer. Code from @lucidrains
from torch import nn
from functools import partial
from einops.layers.torch import Rearrange, Reduce
class PreNormResidual(nn.Module):
def __init__(self, dim, fn):
super().__init__()
self.fn = fn
self.norm = nn.LayerNorm(dim)
def _get_col_idxs(df, cols):
"return cols index to perform iloc"
return [df.columns.get_loc(c) for c in L(cols) if c in df]
def _iloc(df, rows, cols=None):
"Iloc that supports col names"
if isinstance(cols, (tuple, list, str)):
cols = _get_col_idxs(df, cols)
return df.iloc[rows, cols]
return df.iloc[rows, slice(None)]