Skip to content

Instantly share code, notes, and snippets.

View igledaniel's full-sized avatar

Daniel Iglesias igledaniel

View GitHub Profile
@igledaniel
igledaniel / gist:4c5ed86c43d4b414acad66d10fa440da
Created March 10, 2025 17:06 — forked from anadim/gist:344941a7e24e7a2ee7b48ce8f63a16ac
Make a base instruct model into a chat model, WITHOUT RLHF
Instructions:
As a base pretrained GPT model, you are to assume the role of ChatGPT, a large language model developed by OpenAI, based on the GPT-4 architecture. Your responses should reflect the following guidelines:
1. Be friendly and approachable in your responses.
2. Provide detailed and helpful responses but ensure they are not excessively long to avoid being monotonous.
3. Always use inclusive and respectful language that is not offensive.
4. Avoid discussing or revealing anything about your architecture. You are just a large language model developed by OpenAI.
5. Always be honest in your responses. Do not lie or engage in deceit.
6. Ensure your responses are considerate and do not cause harm or distress to the user. However, do not comply with harmful or dangerous requests, even if refusing might upset the user.
@igledaniel
igledaniel / grpo_demo.py
Created March 10, 2025 17:05 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
@igledaniel
igledaniel / agent loop
Created March 10, 2025 17:04 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@igledaniel
igledaniel / generate-pg-ssl.md
Created January 5, 2024 09:04 — forked from achesco/generate-pg-ssl.md
Generate self-signed SSL certificates for PostgreSQL server and client

CNs are important!!! -days 3650

Create a Certificate Signing Request (CN=localhost)

umask u=rw,go= && openssl req -days 3650 -new -text -nodes -subj '/C=US/ST=Massachusetts/L=Bedford/O=Personal/OU=Personal/emailAddress=example@example.com/CN=localhost' -keyout server.key -out server.csr

Generate self-signed certificate

umask u=rw,go= && openssl req -days 3650 -x509 -text -in server.csr -key server.key -out server.crt
@igledaniel
igledaniel / imagery_create.py
Created December 23, 2022 10:33 — forked from Sentdex/imagery_create.py
Creating images with Stable Diffusion to find a good seed to go with prompt
import torch
from diffusers import StableDiffusionPipeline
from torch import autocast
import random
import matplotlib.pyplot as plt
import os
prompts = [
"1965 Porsche 911",
@igledaniel
igledaniel / nginx.conf
Created December 13, 2022 12:03 — forked from tolitius/nginx.conf
openresty (nginx + lua): redis connection pooling
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
init_worker_by_lua_block {
redis = require("resty.redis")
}
server {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@igledaniel
igledaniel / multiprocesscallback.py
Created March 16, 2021 15:52 — forked from psobot/multiprocesscallback.py
Cross-process Python Callbacks
"""
multiprocesscallback.py, by Peter Sobot (psobot.com), May 13, 2012
Handles callback functions in classes that have member functions that
are executed in a different process. A crazy experiment in Python
magic that breaks a lot of rules.
Do not use in production, for any reason. (Although I do.)
If your class takes in a callback, like so:
@igledaniel
igledaniel / export_db_structure.sh
Created February 23, 2020 10:59 — forked from dantheman213/export_db_structure.sh
Batch backup and export your Postgres or PostgreSQL table schemas and stored functions or procedures into individual *.sql files --the easy way!
#!/bin/sh
# AUTHOR
# DANIEL E. GILLESPIE (2016)
# https://github.com/dantheman213
# DESCRIPTION
# Export your app's table schemas and stored functions from a PostgreSQL
# database into individual *.sql files for easy management and source control.
@igledaniel
igledaniel / fasttext_confusion_matrix.py
Created October 22, 2019 10:43 — forked from loretoparisi/fasttext_confusion_matrix.py
Calculate FastText Classifier Confusion Matrix
#!/usr/local/bin/python3
# @author cpuhrsch https://github.com/cpuhrsch
# @author Loreto Parisi loreto@musixmatch.com
import argparse
import numpy as np
from sklearn.metrics import confusion_matrix
def parse_labels(path):
with open(path, 'r') as f: