Skip to content

Instantly share code, notes, and snippets.

View asprenger's full-sized avatar

Andre Sprenger asprenger

View GitHub Profile
@asprenger
asprenger / gist:5e2295e27282469e5bf3a7b509bc350b
Created December 15, 2023 10:44
Anyscale Endpoint mistralai/Mixtral-8x7B-Instruct-v0.1 demo
import openai
ANYSCALE_ENDPOINT_KEY = "{ANYSCALE_ENDPOINT_KEY}"
client = openai.OpenAI(base_url="https://api.endpoints.anyscale.com/v1", api_key=ANYSCALE_ENDPOINT_KEY)
response = client.chat.completions.create(
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
messages=[{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the best French cheese?"}],
temperature=0.7
)
@asprenger
asprenger / codellama_anyscale_endpoint_sample.py
Created August 26, 2023 12:35
Generate code using CodeLlama-34b-Instruct-hf on Anyscale Endpooint
import openai
system_msg = "You are an expert software developer that always creates perfect code."
user_msg = """In Bash, how do I list all text files in the current directory (excluding subdirectories) that have
been modified in the last month. Generate only the command and no explanation or comments."""
message_history = [
{"role": "system", "content": system_msg},
{"role": "user", "content": user_msg}
]
@asprenger
asprenger / finetune_llama_v2.py
Created July 26, 2023 07:48 — forked from younesbelkada/finetune_llama_v2.py
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@asprenger
asprenger / install_tvm_macos_m1
Created August 26, 2022 07:55
Install Apache TVM with TensorFlow support on MacOS with M1 (ARM64 architecture)
# Install Apache TVM with TensorFlow support on MacOS with M1 (ARM64 architecture)
Here is the link to the TVM installation documentation: [Install from Source](https://tvm.apache.org/docs/install/from_source.html).
## Install Miniforge
Install Miniforge from their official [page] (https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh)
Once downloaded:
@asprenger
asprenger / gist:d59cc4697172fddf968169600421a366
Created January 17, 2019 08:45
Python unittest Assertions cheat sheet
assertEqual(a, b)
a == b
assertNotEqual(a, b)
a != b
assertTrue(x)
bool(x) is True
assertFalse(x)
@asprenger
asprenger / setup_ml_workshop.md
Last active October 15, 2018 07:08
Setup instruction for the "Introduction to Machine Learning workshop"

Workshop Requirements

This are the requirements for the Introduction to Machine Learning Workshop on 15./16 Oct. and 22./23. Okt.

You should have some basic linear algebra understanding. A good refresher would be chapter 2.1 and 2.2 from Deeplearning - Linear Algebra. This are just 5 pages, so it should be a quick read.

Some basic knowledge of Python will be useful but is not required. There will be code examples in Python but they should be easy to understand. You are not required to do any Python coding yourself.

You need to install the Anaconda Python distibution and a couple of Python libraries.

@asprenger
asprenger / Install NVIDIA Driver and CUDA.md
Created June 7, 2018 14:38 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS