Skip to content

Instantly share code, notes, and snippets.

View gbertb's full-sized avatar

Gilbert Bagaoisan gbertb

View GitHub Profile
@jwbee
jwbee / jq.md
Last active July 15, 2025 12:12
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

This Microservice Should Have Been a Library

About 6 years ago when I was a PHP ecommerce dev, I've always wanted to work with distributed systems and microservices. They seemed so cool and the new way of architecting software systems because all of big tech did it. But now working with them day to day for about 3 years I came to realize that my initial anticipation was stupid. Well, not stupid in the traditional sense, because how could I have known what I'd get myself into.

Microservices and distributed systems have been preached to solve two major problems: Scale and scale.

So let's talk about them.

@migtissera
migtissera / mistral-7B-qlora.yaml
Last active March 30, 2024 22:08
Axolotl config to train a Mistral-7B base using QLoRA on 24GB GPU
base_model: /path/to/Mistral-7B-v0.1
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer
is_llama_derived_model: true
load_in_8bit: false
load_in_4bit: true
strict: false
datasets:
@olafgeibig
olafgeibig / nous-hermes-2-solar.ollama
Created January 3, 2024 09:35
Ollama modelfile for nous-hermes-2-solar-10.7b
FROM ./nous-hermes-2-solar-10.7b.Q5_K_M.gguf
PARAMETER num_ctx 4096
TEMPLATE """<|im_start|>system
{{ .System }}<|im_end|>
<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
@mberman84
mberman84 / gist:ea207e7d9e5f8c5f6a3252883ef16df3
Created November 29, 2023 15:31
AutoGen + Ollama Instructions
1. # create new .py file with code found below
2. # install ollama
3. # install model you want “ollama run mistral”
4. conda create -n autogen python=3.11
5. conda activate autogen
6. which python
7. python -m pip install pyautogen
7. ollama run mistral
8. ollama run codellama
9. # open new terminal
import os
import autogen
import memgpt.autogen.memgpt_agent as memgpt_autogen
import memgpt.autogen.interface as autogen_interface
import memgpt.agent as agent
import memgpt.system as system
import memgpt.utils as utils
import memgpt.presets as presets
import memgpt.constants as constants
import memgpt.personas.personas as personas
@Teque5
Teque5 / get_dataverse_doi.py
Created October 24, 2023 21:39
Dataverse DOI Scraper
#!/usr/bin/env python3
# SPDX-FileContributor: 2023 The Aerospace Corporation
# SPDX-DocumentComment: Approved 2023-10-23 Request # OSS23-0008
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Dataverse Scraper"""
import argparse
from pathlib import Path
import hashlib
import logging
import subprocess

Fine-tuning llama 2 7B to analyze financial reports and write “funny” tweets

Sharing some insights from a recent weekend fun project where I tried to analyze and summarize financial reports using a fine-tuned LLM.

My initial goal was to train a model to summarize the annual/quarterly financial reports of public companies (aka 10-K / 10-Q). But, realizing that straightforward financial summaries are boring, I thought of tuning LLM to generate sarcastic summaries of these reports. Something short I could post on Twitter.

Data exploration and dataset prep

Working with financial reports ain’t easy. You download them in html format, they’re pretty dense with ~100 pages filled with tables that can be tough to parse, many legal disclaimers and various useless info. I knew I wanted to get 3-5 funny tweets as an output from a report. But I spent quite some time figuring out what data to actually input to get the result - a page, a section, a table?

@bonadio
bonadio / autogen_chat.py
Last active August 28, 2024 11:48
Very basic implementation of Autogen with FastApi using websocket to interact with user_proxy in a web app
import autogen
from user_proxy_webagent import UserProxyWebAgent
import asyncio
config_list = [
{
"model": "gpt-3.5-turbo",
# "api_key": "<YOUR KEY HERE>"
}
]
@veekaybee
veekaybee / normcore-llm.md
Last active August 9, 2025 06:46
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models