Skip to content

Instantly share code, notes, and snippets.

View alexzhang2015's full-sized avatar
🎯
Focusing

alex alexzhang2015

🎯
Focusing
View GitHub Profile
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 22, 2024 08:47
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@younesbelkada
younesbelkada / finetune_llama_v2.py
Last active May 14, 2024 05:46
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@xinqiu
xinqiu / bot.py
Created April 9, 2023 11:37
Creating a private data QA bot entirely using the open-source LLM project
from langchain import PromptTemplate, LLMChain
from langchain.document_loaders import UnstructuredHTMLLoader
from langchain.embeddings import LlamaCppEmbeddings
from langchain.llms import LlamaCpp
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores.faiss import FAISS
loader = UnstructuredHTMLLoader("langchain/docs/_build/html/index.html")
embedding = LlamaCppEmbeddings(model_path="path/models/ggml-model-q4_0.bin")
llm = LlamaCpp(model_path="path/models/ggml-model-q4_0.bin")
@rain-1
rain-1 / GPT-4 Reverse Turing Test.md
Last active April 16, 2024 23:19
GPT-4 Reverse Turing Test

The reverse turing test

I asked GPT-4 to come up with 10 questions to determine if the answerer was AI or human.

I provided my own answers for these questions and I also asked ChatGPT to answer them.

The result is that GPT-4 was able to correctly differentiate between AI and Human.

@snikch
snikch / .env.example
Last active May 20, 2021 12:46
Chia Network Docker Compose
PLOTS_TMP_DIR=/mnt/scratch/plots
PLOTS_FINAL_DIR=/mnt/storage/plots
@adamelliotfields
adamelliotfields / docker-compose.yml
Created February 10, 2019 22:39
Docker Compose Mongo with Mongo Express
version: "3.5"
services:
mongo:
image: mongo:latest
container_name: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
ports:
@hluaces
hluaces / testio.sh
Created January 23, 2019 17:59 — forked from jsandas/testio.sh
Disk IO test for linux
#!/bin/bash
# References
# https://devopsideas.com/benchmarking-disk-iops-aws-vs-digitalocean/
# https://wiki.mikejung.biz/Benchmarking#Fio_Test_Options_and_Examples
# https://tobert.github.io/post/2014-04-17-fio-output-explained.html
# Requires linux packages: fio ioping
@zhu327
zhu327 / wrk_log.lua
Created August 14, 2018 02:15
logging response from wrk
wrk.path = "/rest/ping"
wrk.method = "POST"
wrk.body = "id=7579764573763278289&platformid=ANDROID&version=1.0.0"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
wrk.headers["deviceid"] = "354435052821931"
wrk.headers["Accept"] = "application/json"
logfile = io.open("wrk.log", "w");
local cnt = 0;

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@ferventcoder
ferventcoder / disablechromeautoupdate.ps1
Created February 9, 2018 12:58
Disable Google Chrome Automatic Update Policy
$googlePoliciesKey = 'HKLM:\Software\Policies\Google'
if (!(Test-Path $googlePoliciesKey)) {
New-Item -Path $googlePoliciesKey -Force | Out-Null
}
New-ItemProperty $googlePoliciesKey -Name 'UpdateDefault' -Value 0 -PropertyType DWORD -Force | Out-Null