Some notes and references while exploring the GitHub CLI extension for the GitHub Copilot CLI.
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
#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 |
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 | |
### 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 |
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
>>> 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 |
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.
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 | |
### 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 |
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
$ pdfToAudio.py --pdf <your pdf file here>
You should have the conmand pdftotext
from poppler-utils
installed:
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
""" | |
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. |
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
# 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 |
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
""" | |
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. |
NewerOlder