Skip to content

Instantly share code, notes, and snippets.

View nateraw's full-sized avatar
💯

Nathan Raw nateraw

💯
View GitHub Profile
@hamelsmu
hamelsmu / is_fine_tuning_valuable.md
Last active April 4, 2024 01:22
My thoughts re: Is fine tuning still valuable?

Here is my personal opinion about the questions I posed in this tweet:


I think that fine-tuning is still very valuable in many situations. I’ve done some more digging and I find that people who say that fine-tuning isn't useful are indeed often working on products where fine-tuning isn't likely to be useful:

  • They are making developer tools - foundation models have been trained extensively on coding tasks.
  • They are building foundation models and testing for the most general cases. But the foundation models themselves are also being trained for the most general cases.
  • They are building a personal assistant that isn’t scoped to any type of domain or use case and is essentially similar to the same folks building foundation models.
@karpathy
karpathy / stablediffusionwalk.py
Last active April 25, 2024 11:25
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4

Lots of folks have asked me about my thoughts on Kaseya’s purchase of Datto:

Until recently I have been very much telling everyone to assume positive intent. Kaseya is looking to continue Datto’s success. In general, people don’t spend 6+ Billion dollars on something they intend to break. Change is inevitable and mistakes will be made but by and large Datto should expect to continue to be the company that is loved by employees and customers alike.

This past week, many current members of the Datto team have reached out deeply dismayed. There is a concern that the current trajectory from Datto’s new owners will snuff the flame that makes Datto a place to come “Do your life’s work.”

I am not associated with the company any more so my understanding of the specifics comes entirely second hand. Current team members have reached out and described the following:

- Sidelining Employee Resource Groups that support under represented people at the company
@rochacbruno
rochacbruno / validate_dataclass.py
Created September 30, 2021 11:13
Validate Dataclass Python
from typing import Union, List
from dataclasses import dataclass
class Validations:
def __post_init__(self):
"""Run validation methods if declared.
The validation method can be a simple check
that raises ValueError or a transformation to
/*
* Converts table from [[Header0, Header1, Header2], [Column0Val0, Column1Val0, Column2Val0], ...]
* to {Header0: [ColumnVal0, ...], Header1: [Column1Val0, ...], Header2: [Column2Val0, ...]}
*/
function convertTableToData(table) {
transposed = table[0].map((_, colIndex) => table.map(row => row[colIndex]));
result = {}
for(var i = 0; i < transposed.length; i++) {
header = transposed[i][0]
result[header] = transposed[i].slice(1, 4).map(String);
@rwightman
rwightman / timm_unet.py
Created April 15, 2021 19:12
An example U-Net using timm features_only functionality.
""" A simple U-Net w/ timm backbone encoder
Based off an old version of Unet in https://github.com/qubvel/segmentation_models.pytorch
Hacked together by Ross Wightman
"""
from typing import Optional, List
import torch
@pzelasko
pzelasko / pytorch_shared_memory_disable.py
Created March 1, 2021 16:59
Disable shared memory in PyTorch dataloader
import sys
import torch
from torch.utils.data import dataloader
from torch.multiprocessing import reductions
from multiprocessing.reduction import ForkingPickler
default_collate_func = dataloader.default_collate
def default_collate_override(batch):
@ramdesh
ramdesh / keras_model_s3_wrapper.py
Created December 8, 2020 21:56
Save and load Keras models to and from AWS S3
import s3fs
import zipfile
import tempfile
import numpy as np
from tensorflow import keras
from pathlib import Path
import logging
AWS_ACCESS_KEY="aws_access_key"
@egocarib
egocarib / gist:ea022799cca8a102d14c54a22c45efe0
Created October 22, 2020 01:50
pillow transparent gif creation workaround
# This code adapted from https://github.com/python-pillow/Pillow/issues/4644 to resolve an issue
# described in https://github.com/python-pillow/Pillow/issues/4640
#
# There is a known issue with the Pillow library that messes up GIF transparency by replacing the
# transparent pixels with black pixels (among other issues) when the GIF is saved using PIL.Image.save().
# This code works around the issue and allows us to properly generate transparent GIFs.
from typing import Tuple, List, Union
from collections import defaultdict
from random import randrange
@scottire
scottire / interactive_audio_plots.py
Last active March 11, 2023 10:42
Interactive and clickable plots using Panel, Holoviz and Bokeh in Jupyter Notebooks
import numpy as np
import panel as pn
import holoviews as hv
hv.extension("bokeh")
# hv.extension('matplotlib')
from holoviews.streams import Stream, Params
from scipy.io import wavfile
from scipy.signal import spectrogram
rate, data = wavfile.read('/filepath.wav')