Skip to content

Instantly share code, notes, and snippets.

View wassname's full-sized avatar
🙃

Michael J Clark wassname

🙃
View GitHub Profile
#Add e5-instruct-mistral layers, so they naming is different than
# original mistral instruct one
from __future__ import annotations
from typing import Sequence
from .constants import MODEL_ARCH, MODEL_TENSOR, MODEL_TENSORS, TENSOR_NAMES
@0xdevalias
0xdevalias / _gh-cli-copilot-api.md
Last active January 16, 2024 06:40
Some notes and references while exploring the GitHub CLI extension for the GitHub Copilot CLI
@wassname
wassname / cuda_11.8_installation_on_Ubuntu_22.04
Last active October 6, 2023 04:20 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@mrtysn
mrtysn / openai-custom-instructions.txt
Last active October 6, 2023 10:53
ChatGPT Custom Instructions
>>> What would you like ChatGPT to know about you?
I have been using computers since 1997. I know the ins and outs of them.
Furthermore, I want to get a lot of high quality work done in a very short amount of time.
I try to keep my search time at O(1) and I expect the same from others.
Finding a way to solve a problem should be done very quickly with a very high accuracy.
>>> How would you like ChatGPT to respond?
— Be highly organized
@izikeros
izikeros / README.md
Last active March 14, 2024 09:53
[split text fixed tokens] Split text into parts with limited length in tokens #llm #tokens #python

Text Splitter

Code style: black MIT license

A Python script for splitting text into parts with controlled (limited) length in tokens. This script utilizes the tiktoken library for encoding and decoding text.

Table of Contents

@MihailCosmin
MihailCosmin / cuda_11.8_installation_on_Ubuntu_22.04
Last active March 16, 2024 04:33 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@endes0
endes0 / README.md
Last active October 5, 2023 10:16
PDF File to audiobook using facebook fairseq TTS.

This script will create an audio file for each page of a PDF, reading it trought Fastspeech2 using fairseq framework. Perfect for creating audiobooks. It also reads the PDF table of contents and groups the files by the top level charapters. Finally it creates a playlist.

Tested on Ubuntu 22.04.1 and Python 3.10.6

Usage

$ pdfToAudio.py --pdf <your pdf file here>

Requeriments

You should have the conmand pdftotext from poppler-utils installed:

@wassname
wassname / ordered_quantile_loss_for_ml.py
Last active October 4, 2022 13:08
ordered quantile loss for machine learning
"""
Sometimes we want to use quantiles loss in machine learning, but the outputs are not ordered. This is sometimes called the quantile crossover problem.
Surely it would help to impose the constraint that the quantiles must be ordered?
What's the best way to do this?
Well it seems me that we should predict differences from the median,
and apply a softplus to make sure the differences are only in one direction.
Note this will NOT work for very small target values. Because we are using a softplus the model must output very large
logits to get very small numbers. This means it will have difficulty with small y values.
@danesherbs
danesherbs / context_hook.py
Last active February 11, 2024 01:04
A PyTorch hook that's registered in a `with` statement
# This hook is particularly useful when ablating layers
class ContextHook:
def __init__(self, layer):
self.layer = layer
def __enter__(self):
self.handle = self.layer.register_forward_hook(self.hook)
return self
@wassname
wassname / pandas_cache.py
Last active June 18, 2023 03:21
a simple pandas and pickle cache for complex situations, like deep learning where you can't easily cachebust based on the model
"""
Implements on disk caching of transformed dataframes
Used on a function that returns a single pandas object,
this decorator will execute the function, cache the dataframe as a pickle
file using the hash of function and subdirectory, and the arguments and filename.
The next time the function runs, if the hashes match what is on disk, the decoratored function will simply load and return
the pickled pandas object.
This can result in speedups of 10 to 100 times, or more, depending on the
complexity of the function that creates the dataframe.