Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
This file contains 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 Any, Optional, Union, Tuple | |
import torch | |
from torch import nn | |
from transformers.activations import ACT2FN | |
from transformers.models.deberta.modeling_deberta import ( | |
DebertaPreTrainedModel, | |
DebertaModel, | |
) | |
from transformers.models.deberta_v2.modeling_deberta_v2 import ( |
This file contains 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
# I added all the imports by hand | |
import torch | |
from torchvision.datasets import ImageFolder | |
from torchvision import transforms,models | |
from torch import nn,optim | |
# For all functions including this one, I wrote the name and docstring, and sometimes also the param names | |
def finetune(folder, model): | |
"""fine tune pytorch model using images from folder and report results on validation set""" | |
if not os.path.exists(folder): raise ValueError(f"{folder} does not exist") |
This file contains 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 fastcore.basics import patch_to | |
class Demo: | |
val = 10 | |
def __init__(self, val): | |
self.val = val | |
# ==================== | |
# The default mode |
.env
file for me sparing me the need to pollute my session with environment variables.
I've been using Fish shell for years which is great and all, but one thing that has got me frustrated is using it with .env
files.
When attempting to run source .env
in a project, I usually encounter this problem:
This file contains 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
#!/usr/bin/env bash | |
### | |
# NB: You probably don't want this gist any more. | |
# Instead, use this version from `fastsetup`: | |
# https://github.com/fastai/fastsetup/blob/master/setup-conda.sh | |
### | |
set -e | |
cd |
This file contains 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
# -*- coding: utf-8 -*- | |
""" Deletes all tweets below a certain retweet threshold. | |
""" | |
import tweepy | |
from datetime import datetime | |
# Constants | |
CONSUMER_KEY = '' |
This file contains 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
# Requirements | |
#1. Enable IPv6 for the docker daemon: | |
#$ cat /etc/docker/daemon.json | |
#{ | |
# "ipv6": true, | |
# "fixed-cidr-v6": "2001:db8:1::/64" | |
#} | |
#2. reload docker : | |
#$ sudo systemctl reload docker | |
#3. start: |
This file contains 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
#!/bin/bash | |
# This is a quick installer | |
# script I made to build and install the latest version of | |
# fish on my Raspberry Pi. | |
# | |
# Use at your own risk as I have made no effort to make | |
# this install safe! | |
set -e |
This file contains 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
# Put this function to your .bashrc file. | |
# Usage: mv oldfilename | |
# If you call mv without the second parameter it will prompt you to edit the filename on command line. | |
# Original mv is called when it's called with more than one argument. | |
# It's useful when you want to change just a few letters in a long name. | |
# | |
# Also see: | |
# - imv from renameutils | |
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste) |
NewerOlder