Skip to content

Instantly share code, notes, and snippets.

@abacaj
abacaj / humaneval_m7x8.jsonl
Created December 9, 2023 01:04
Results from running "mistral-8x7B" on humaneval (code benchmark)
{"task_id": "HumanEval/0", "prompt": "from typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\" Check if in given list of numbers, are any two numbers closer to each other than\n given threshold.\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n False\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n True\n \"\"\"\n", "canonical_solution": " for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n distance = abs(elem - elem2)\n if distance < threshold:\n return True\n\n return False\n", "test": "\n\nMETADATA = {\n 'author': 'jt',\n 'dataset': 'test'\n}\n\n\ndef check(candidate):\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\n assert candidate([1.0, 2.0,
@VikParuchuri
VikParuchuri / algo.md
Created October 13, 2023 16:19
Sample textbooks

1. Algorithm Design and Analysis

One important aspect of algorithm design is problem-solving strategies. This involves breaking down a complex problem into smaller, more manageable subproblems. By solving these subproblems, we can then combine their solutions to solve the original problem. This approach is known as the divide-and-conquer method.

Another important aspect of algorithm design is understanding the time and space complexity of an algorithm. Time complexity refers to the amount of time an algorithm takes to run, while space complexity refers to the amount of memory an algorithm requires. By analyzing the time and space complexity of an algorithm, we can determine its efficiency and scalability.

For example, let's consider the problem of finding the largest number in a list. One possible algorithm is to iterate through the list and keep track of the largest number encountered so far. This algorithm has a time complexity of O(n), where n is the size of the list. This means that the algorithm's

@veekaybee
veekaybee / normcore-llm.md
Last active July 3, 2024 22:14
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

# Must have conda installed
# It costs approximately $0.2 (in GPT-4 API fees) to generate one example with analysis and design, and around $2.0 for a full project.
conda create -n metagpt python=3.11.4
conda activate metagpt
npm --version # to check you have npm installed
# optional: install node if you don't have it
npm install -g @mermaid-js/mermaid-cli
git clone https://github.com/geekan/metagpt
cd metagpt
@wolfecameron
wolfecameron / llm_preso_links_2.txt
Created August 10, 2023 13:42
LLM Presentation Links (EY Week #2)
@mlabonne
mlabonne / finetune_llama2.py
Last active May 14, 2024 16:33
Easy Llama 2 fine-tuning script (📝 Article: https://tinyurl.com/finetunellama2)
# Based on younesbelkada/finetune_llama_v2.py
# Install the following libraries:
# pip install accelerate==0.21.0 peft==0.4.0 bitsandbytes==0.40.2 transformers==4.31.0 trl==0.4.7 scipy
from dataclasses import dataclass, field
from typing import Optional
import torch
from datasets import load_dataset
from transformers import (
from langchain.chat_models import ChatOpenAI
from pydantic import BaseModel, Field
from langchain.document_loaders import UnstructuredURLLoader
from langchain.chains.openai_functions import create_extraction_chain_pydantic
class LLMItem(BaseModel):
title: str = Field(description="The simple and concise title of the product")
description: str = Field(description="The description of the product")
def main():
@svpino
svpino / file.py
Created June 16, 2023 13:19
OpenAI's API undocumented function calling python
import openai
openai.api_key = "YOUR KEY GOES HERE"
def get_completion(messages):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613",
messages=messages,
functions=[{
"name": "fake",
@srikumarks
srikumarks / mandel.jl
Last active May 18, 2023 15:02
Julia mandelbrot for benchmarking against Python/Mojo
function mandelbrot_kernel(c, max_iter)
z = c
for i in 1:max_iter
z = z * z + c
if abs2(z) > 4
return i-1
end
end
return max_iter
@eugeneyan
eugeneyan / mandelbrot-mojo.md
Last active April 4, 2024 15:52
Benchmarking Mojo vs. Python on Mandelbrot sets

Mandelbrot in Mojo with Python plots

Not only Mojo is great for writing high-performance code, but it also allows us to leverage huge Python ecosystem of libraries and tools. With seamless Python interoperability, Mojo can use Python for what it's good at, especially GUIs, without sacrificing performance in critical code. Let's take the classic Mandelbrot set algorithm and implement it in Mojo.

We'll introduce a Complex type and use it in our implementation.

Mandelbrot in python