Skip to content

Instantly share code, notes, and snippets.

View kemingy's full-sized avatar
🈚
actions

Keming kemingy

🈚
actions
View GitHub Profile
@kemingy
kemingy / read_vecs.py
Created June 5, 2024 12:42
read the .bvecs, .fvecs and .ivecs vector file formats
from struct import unpack
import numpy as np
def read_vec(filepath: str, vec_type: np.dtype = np.float32):
"""Read vectors from a file. Support `fvecs`, `ivecs` and `bvecs` format.
Args:
filepath: The path of the file.
vec_type: The type of the vectors, choose from [np.float32, np.int32, np.dtype('u1')]
@kemingy
kemingy / Dockerfile
Last active September 21, 2023 06:32
vllm
# use devel since vllm need to compile the paged attention
ARG base=nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
FROM ${base}
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
ARG commit=main
ARG CONDA_VERSION=py310_23.3.1-0
RUN apt update && \
@kemingy
kemingy / emb_encode.md
Created May 29, 2023 16:22
test OpenAI embedding API encode method
import json
import base64

import msgpack
import numpy as np

dim = 1536
emb = np.random.rand(dim).astype(np.float32)
emb_list = emb.tolist()
package main
import (
"fmt"
"sync"
"go.starlark.net/starlark"
"go.starlark.net/starlarkstruct"
)
from flask import Flask, request
app = Flask(__name__)
@app.route("/inference", methods=["POST"])
def inference():
return request.get_data()
@kemingy
kemingy / logo.svg
Last active September 24, 2021 04:27
MOSEC SVG Logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kemingy
kemingy / wezterm.lua
Last active November 23, 2022 02:12
config for wezterm (wsl)
local wezterm = require 'wezterm';
function recompute_padding(window)
local window_dims = window:get_dimensions();
local overrides = window:get_config_overrides() or {}
if not window_dims.is_full_screen then
if not overrides.window_padding then
-- not changing anything
return;
@kemingy
kemingy / calligraphy.md
Last active August 29, 2021 05:39
Chinese Calligraphy

三要素

  • 用笔--五执笔+九用
  • 识势--永字八法+五势
  • 裹束--大圈+小圈

主要书体