Skip to content

Instantly share code, notes, and snippets.

@Artefact2
Artefact2 / README.md
Last active December 12, 2024 13:17
GGUF quantizations overview

Which GGUF is right for me? (Opinionated)

Good question! I am collecting human data on how quantization affects outputs. See here for more information: ggerganov/llama.cpp#5962

In the meantime, use the largest that fully fits in your GPU. If you can comfortably fit Q4_K_S, try using a model with more parameters.

llama.cpp feature matrix

See the wiki upstream: https://github.com/ggerganov/llama.cpp/wiki/Feature-matrix

@ole
ole / swift-has-feature.sh
Last active November 21, 2024 10:32
swift-list-feature: List Swift compiler upcoming and experimental feature flags. ★ swift-has-feature: Check if a given compiler knows a specific feature flag, and whether it's an upcoming or experimental flag.
#!/bin/zsh
# Test if the Swift compiler knows about a particular language feature.
#
# Usage:
#
# swift-has-feature [--swift SWIFT_PATH] [--language-version LANGUAGE_VERSION] FEATURE
#
# The feature should be an upcoming or experimental language feature,
# such as `"StrictConcurrency"` or `"ExistentialAny"`.
@jrknox1977
jrknox1977 / ollama_dspy.py
Created February 9, 2024 18:06
ollama+DSPy using OpenAI APIs.
# install DSPy: pip install dspy
import dspy
# Ollam is now compatible with OpenAI APIs
#
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call.
# If you do not include this you will get an error.
#
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete.
# At least with mistral.
@jrknox1977
jrknox1977 / dspy_tgi_mistral.py
Last active April 14, 2024 08:42
DSPy - using TGI for local model
# install DSPy: pip install dspy
import dspy
# This sets up the language model for DSPy in this case we are using mistral 7b through TGI (Text Generation Interface from HuggingFace)
mistral = dspy.HFClientTGI(model='mistralai/Mistral-7B-v0.1', port=8080, url='http://localhost')
# This sets the language model for DSPy.
dspy.settings.configure(lm=mistral)
# This is not required but it helps to understand what is happening
@jrknox1977
jrknox1977 / dspy_chain_of_thought_example.py
Created February 5, 2024 18:56
DSPy example with chain of thought.
# install DSPy: pip install dspy
import dspy
# This sets up the language model for DSPy in this case we are using GPT-3.5-turbo
turbo = dspy.OpenAI(model='gpt-3.5-turbo')
# This sets the language model for DSPy. This must be set or you get an error that is not helpful:
# --> temperature = lm.kwargs['temperature'] if temperature is None else temperature
# --> AttributeError: 'NoneType' object has no attribute 'kwargs'
@jrknox1977
jrknox1977 / basic_qa.py
Last active April 14, 2024 08:43
Simple DSPY example of BasicQA
# install DSPy: pip install dspy
import dspy
# This sets up the language model for DSPy in this case we are using GPT-3.5-turbo
turbo = dspy.OpenAI(model='gpt-3.5-turbo')
# This sets the language model for DSPy. This must be set or you get an error that is not helpful:
# --> temperature = lm.kwargs['temperature'] if temperature is None else temperature
# --> AttributeError: 'NoneType' object has no attribute 'kwargs'
@MarcoEidinger
MarcoEidinger / findRequiredReasonAPIUsage.sh
Created August 21, 2023 19:55
A shell script to find if any "required reason API" are used in Swift or Objective-C files within that folder or subfolders
#!/bin/bash
# https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api
searchTerms=(
# File timestamp APIs
"creationDate"
"modificationDate"
"fileModificationDate"
"contentModificationDateKey"
"creationDateKey"
@brettohland
brettohland / 1.0 FormatStyle in Excruciating Detail.md
Last active July 23, 2024 12:12
FormatStyle in Excruciating Detail
@atierian
atierian / README.md
Last active July 12, 2024 07:56
Allow consumers of SwiftUI UIViewRepresentable conforming Views to inject wrapped UIView delegate implementations through ViewModifiers using a ProxyDelegate.

Allow the consumer of a SwiftUI UIViewRepresentable View to inject delegate implementations for the wrapped UIView through View Modifiers by using a proxy delegate.

This can be a helpful pattern when providing a SwiftUI wrapper for a very heavy and complex UIView, where the wrapper implements many of the delegate methods of the wrapped UIView. But you want someone consuming the wrapper to have the ability to inject their own delegate method implementations to override yours, or to leverage some of the methods your not implementing.