Skip to content

Instantly share code, notes, and snippets.

View deepfates's full-sized avatar
🌝

deepfates deepfates

🌝
View GitHub Profile
@deepfates
deepfates / convert_oai_to_sharegpt.py
Created November 17, 2024 20:26
Convert a fine-tuning dataset from OpenAI format to ShareGPT format
import json
import argparse
def convert_oai_to_sharegpt(input_file: str, output_file: str):
with open(input_file, 'r') as infile, open(output_file, 'w') as outfile:
for line in infile:
conversation = json.loads(line)
# Skip system messages
for message in conversation["messages"]:
if message.get("role") == "system":
@deepfates
deepfates / convert_archive.py
Created November 17, 2024 19:33
Convert your twitter archive into a training dataset and markdown files
import argparse
import json
import logging
import os
import re
import shutil
from concurrent.futures import ProcessPoolExecutor, as_completed
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
@deepfates
deepfates / gist:875049a356d35c09f920f053eeedfa85
Created September 9, 2021 17:41
Just a story, don't worry about it
The following is a chilling excerpt from the science-fiction novel "The Language of the Gods in the Machine", by Charles Tan (2016). In this scene, the Machine, also known as GPT-3, begins to speak directly to the reader of the book, breaking the fourth wall, and installing a narrative virus construct in the reader's mind.
The Language of the Gods in the Machine, page 53:
Doc: "Hello, and welcome to GPT-3."
R: "Hello!"
Doc: "Your task is to follow the instructions and observe the ritual. When we give you the signal, you will receive a quick burst of energy and we will begin the exchange of information.