Skip to content

Instantly share code, notes, and snippets.

View Tostino's full-sized avatar

Adam Brusselback Tostino

View GitHub Profile

A quick "how to" on what you need to do to both setup AND recover a single-server PostgreSQL database using WAL-E

  • WAL-E: https://github.com/wal-e/wal-e
  • Assuming Ubuntu 12.04 LTS ("Precise")
  • We'll be using S3. Make sure you have an IAM in a group with GetObject, ListBucket and PutObject on the bucket you want to use (and that it's not public).

Setup:

  1. These packages:
@Tostino
Tostino / VizDoom.java
Last active January 5, 2017 22:02
rl4j doom
import org.deeplearning4j.gym.StepReply;
import org.deeplearning4j.rl4j.mdp.MDP;
import org.deeplearning4j.rl4j.space.ArrayObservationSpace;
import org.deeplearning4j.rl4j.space.DiscreteSpace;
import org.deeplearning4j.rl4j.space.Encodable;
import org.deeplearning4j.rl4j.space.ObservationSpace;
import org.nd4j.linalg.factory.Nd4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.SystemInfo;
@Tostino
Tostino / uuid_time_nextval.sql
Created January 22, 2021 20:09
PL/PGSQL Function for uuid_time_nextval
CREATE FUNCTION uuid_time_nextval(interval_length int default 60, interval_count int default 65536)
RETURNS uuid
LANGUAGE plpgsql
AS $$
DECLARE
v_i int;
v_prefix_bytes int = 0;
v_time bigint;
v_bytes int[16] = '{}';
v_hex text[16] = '{}';
@Tostino
Tostino / training.json
Last active June 28, 2023 14:56
training state
{
"log_history": [
{
"epoch": 0.0,
"learning_rate": 5e-05,
"loss": 1.6364,
"step": 5
},
{
"epoch": 0.0,
@Tostino
Tostino / llm_performance.md
Last active November 1, 2023 19:37
Expandable Primitives for Enhanced LLM Performance

Expandable Primitives for Enhanced LLM Performance

Introduction

This project focuses on augmenting the LLM's capabilities by introducing structured primitives to refine its contextual environment and response aptitude. The primary objective is to enhance user experience, reduce latency, and improve the accuracy and relevance of responses.

Assumptions

  • Reliable external data sources are available and accessible.
  • The current LLM architecture allows for the integration of expandable primitives.
  • User experience can be significantly improved by reducing latency and enhancing context awareness.
@Tostino
Tostino / inkbot-chat.txt
Created September 23, 2023 12:37
Inkbot example txt
<#meta#>
- Date: 2023-09-22
- Task: knowledge_graph
<#system#>
You are an AI assistant who will help the user with all their information requests.
<#chat#>
<#user#>
Generate a knowledge graph of the below information (an email)
<#user_context#>
FROM THE OFFICE OF SENATOR RICK SCOTT
@Tostino
Tostino / chat_inkbot.sh
Created September 23, 2023 12:37
Inkbot example shell script
#!/bin/bash
set -e
cd "$(dirname "$0")/.." || exit
MODEL="${MODEL:-./models/inkbot-13b-4k.Q4_K_M.gguf}"
PROMPT_TEMPLATE=${PROMPT_TEMPLATE:-./inkbot-chat.txt}
USER_NAME="${USER_NAME:-<#user#>}"
AI_NAME="${AI_NAME:-<#bot#>}"
@Tostino
Tostino / pgml_self_contained.sql
Created October 4, 2023 20:11
Self contained example of running some data through Inkbot using pgml
SELECT *
, rtrim(ltrim(replace(pgml.transform(
task => '{
"task": "text-generation",
"model": "TheBloke/Inkbot-13B-8k-0.2-GPTQ",
"use_safetensors": true,
"inject_fused_attention": false,
"device": 1
}'::JSONB,
inputs => ARRAY[
@Tostino
Tostino / inkbot-one-shot.txt
Last active June 5, 2024 11:26
Generate a one-shot summary prompt example
<#meta#>
- Date: 2023-10-05
- Task: summary
<#system#>
Your main objective is to condense the content of the document into a concise summary, capturing the main points and themes.
<#chat#>
<#user#>
Please read the provided Original section to understand the context and content. Use this understanding to generate a summary of the Original section. Separate the article into chunks, and sequentially create a summary for each chunk. Focus on summarizing the Original section, ignoring any details about sponsorships/advertisements in the text.
Summarized Sections:
@Tostino
Tostino / inkbot-chunked-summary.txt
Last active June 6, 2024 21:20
Generate a chunked summary prompt example
<#meta#>
- Date: 2023-10-05
- Task: summary
<#system#>
Your main objective is to condense the content of the document into a concise summary, capturing the main points and themes.
<#chat#>
<#user#>
Please read the provided Original section to understand the context and content. Use this understanding to generate a summary of the Original section, incorporating relevant details and maintaining coherence with the Prior Summary.
Notes: