Skip to content

Instantly share code, notes, and snippets.

View pmbaumgartner's full-sized avatar

Peter Baumgartner pmbaumgartner

View GitHub Profile
from typing import TypedDict
DisplacyDepsWords = TypedDict(
"DisplacyDepsWords", {"text": str, "tag": str, "lemma": Optional[str]}
)
DisplacyDepsArcs = TypedDict(
"DisplacyDepsArcs", {"start": int, "end": int, "label": str, "dir": str}
)
DisplacyDepsData = TypedDict(
"DisplacyDepsData",
@pmbaumgartner
pmbaumgartner / ndict.py
Created February 21, 2023 20:27
create a dictionary based off of string variable names. based on rust struct shorthand init.
def ndict(*args):
"""Return a dictionary with the given keys and their values from globals."""
g = globals()
result = {}
for arg in args:
if arg in g:
result[arg] = g[arg]
else:
raise KeyError(f"Key '{arg}' not found in globals")
return result
@pmbaumgartner
pmbaumgartner / _run_api.sh
Last active January 6, 2024 21:17
Mistal w/ vLLM. Run w/ a RTX 3090
# https://docs.mistral.ai/self-deployment/vllm/
export HF_TOKEN=<Huggingface Token>
docker run --gpus all \
-e HF_TOKEN=$HF_TOKEN -p 8000:8000 \
ghcr.io/mistralai/mistral-src/vllm:latest \
--host 0.0.0.0 \
--model mistralai/Mistral-7B-Instruct-v0.2