Skip to content

Instantly share code, notes, and snippets.

View Jonathan-Adly's full-sized avatar

Jonathan Adly Jonathan-Adly

View GitHub Profile

The core idea in simple terms in the ColPali paper implementation of late-interaction is:

  • We have query embeddings: an array with n vectors, each of size 128 (floats).

  • We have document embeddings: an array with 1038 vectors, each of size 128 (floats).

  • For each query vector (n), we find the most similar document vector by computing the dot product. Here is simple code for straight-forward dot product similarity.

import numpy as np
@Jonathan-Adly
Jonathan-Adly / gist:5fa3f191b0531feae8fe9e3164b68d7c
Last active February 28, 2024 03:36
Web App config for a new ubuntu on Hetzner
git clone <repo> # downloads the repo
sudo apt update && sudo apt upgrade -y #updates system packages
sudo apt install docker.io -y #installs docker
sudo usermod -aG docker $USER #you can use docker without sudo
newgrp docker #enact changes without restarting
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose # install docker-compose
sudo chmod +x /usr/local/bin/docker-compose #give permission to docker-compose
sudo systemctl enable docker #always start docker on start
cd <repo>
docker-compose up -d --build #if port is open via firewall, you can now access the app at <ip>:<port>
<p> Hello, world </p>
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "dictionary.h"
@Jonathan-Adly
Jonathan-Adly / Filter.c
Last active June 11, 2020 16:07
CS50 - PSET4
#include "helpers.h"
#include <math.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
float rgbgray_scale;
for (int i = 0; i < width; i++) //itirate over width
{
for (int j = 0; j < height; j++) //itirate over height
@Jonathan-Adly
Jonathan-Adly / Plurality.c
Last active June 11, 2020 16:07
CS50 - PSET3
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max number of candidates
#define MAX 9
// Candidates have name and vote count
typedef struct
{
@Jonathan-Adly
Jonathan-Adly / Ceasar.c
Last active June 11, 2020 16:07
CS50 - PSET2
#include <stdio.h>
#include <ctype.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, string argv[])
{
if (argc == 2) // needs a character to start, else return error message
{
@Jonathan-Adly
Jonathan-Adly / Cash.c
Created June 11, 2020 15:44
CS50 - PSET1
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
float co; //co is a float
do
{