Skip to content

Instantly share code, notes, and snippets.

View Glavin001's full-sized avatar
💻
Working - I may be slow to respond.

Glavin Wiechert Glavin001

💻
Working - I may be slow to respond.
View GitHub Profile
import base64
from io import BytesIO
from PIL import Image
import torch
import torch.nn as nn
import ollama
from diffusers import DiffusionPipeline, StableDiffusionPipeline
from safetensors.torch import load_file
from transformers import CLIPProcessor, CLIPModel, AutoImageProcessor, AutoModel
@Glavin001
Glavin001 / README.md
Last active October 13, 2023 09:20
Automatic Learning Objective Extraction & Lesson Generation

About

This is a demo of https://github.com/Glavin001/Data2AITextbook

Given a raw/unstructured input and produce high quality dataset for training an expert language model.

The following is an example demonstrating only a couple parts:

  • Learning objective extraction with order/dependencies
  • Lesson generation
  • [TODO] Exercise generation
@Glavin001
Glavin001 / README.md
Created October 13, 2023 05:42
Render Mermaid.js diagrams in a Jupyter/IPython Notebook

Usage

renderMermaid('graph TB\na-->b')

Output

graph TB
@Glavin001
Glavin001 / README.md
Last active April 28, 2024 16:48
How to update CUDA version for TensorDock

How to update CUDA version for TensorDock

Problem

TensorDock is pre-installed with CUDA 10.1 (old).

For many use-cases, such as Flash Attention 2 require newer versions of CUDA.

One symptom of this is nvcc and nvidia-smi will show different CUDA versions:

@Glavin001
Glavin001 / normcore-llm.md
Created August 27, 2023 20:25 — forked from veekaybee/normcore-llm.md
Normcore LLM Reads
@Glavin001
Glavin001 / change-codec.md
Created December 26, 2022 05:50 — forked from dvf/change-codec.md
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@Glavin001
Glavin001 / intelli-scene.json
Last active June 19, 2022 03:35
Intelli Quadcopter v1.2 test
{}
@Glavin001
Glavin001 / README.md
Last active March 5, 2022 07:07
How to list all explicit exports from TypeScript file with TypeScript Compiler/AST

Install ts-node with Node.js v13+ then you can run:

./node_modules/.bin/ts-node -O '{"module":"commonjs"}' list-exports.ts <files...>

The -O '{"module":"commonjs"}' part is to allow using import & export statements: TypeStrong/ts-node#922 (comment)

Demo

@Glavin001
Glavin001 / gist:9ebfb549e8c6b441a0b6eecaca4d72b9
Created October 10, 2019 01:30 — forked from Khoulaiz/gist:41b387883a208d6e914b
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@Glavin001
Glavin001 / Frame.js
Created September 15, 2019 20:42 — forked from robertgonzales/Frame.js
Use React portals to render inside shadow dom and iframes
class Frame extends Component {
componentDidMount() {
this.iframeHead = this.node.contentDocument.head
this.iframeRoot = this.node.contentDocument.body
this.forceUpdate()
}
render() {
const { children, head, ...rest } = this.props
return (