Skip to content

Instantly share code, notes, and snippets.

View trinhtuanvubk's full-sized avatar
🏠
Working from home

Tuan-Vu Trinh trinhtuanvubk

🏠
Working from home
View GitHub Profile
@trinhtuanvubk
trinhtuanvubk / gist:917efc6de780a3fa777c38240adf810e
Created August 20, 2024 03:36 — forked from NN1985/gist:a0712821269259061177c6abb08e8e0a
ElevenLabs Text Input Streaming demo for LLMs
import openai
import elevenlabs
# Uncomment the following lines to set the API keys
openai.api_key = "key_here"
elevenlabs.set_api_key("key_here")
def write(prompt: str):
for chunk in openai.ChatCompletion.create(
model="gpt-3.5-turbo-0301",
@trinhtuanvubk
trinhtuanvubk / postgres-cheatsheet.md
Created August 2, 2024 04:57 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
nodes:
- id: webcam
custom:
source: https://huggingface.co/datasets/dora-rs/dora-idefics2/raw/main/operators/opencv_stream.py
outputs:
- image
- id: idefics2
operator:
python: https://huggingface.co/datasets/dora-rs/dora-idefics2/raw/main/operators/idefics2_op.py
inputs:
@trinhtuanvubk
trinhtuanvubk / fast_speech_text_speech.py
Created February 16, 2024 07:42 — forked from thomwolf/fast_speech_text_speech.py
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@trinhtuanvubk
trinhtuanvubk / PythonTiff.md
Created January 10, 2024 16:49 — forked from ax3l/PythonTiff.md
Python: Write tif
@trinhtuanvubk
trinhtuanvubk / llama-guanaco-fa2.py
Created October 4, 2023 07:07 — forked from younesbelkada/llama-guanaco-fa2.py
Fine tune Llama 2 on Guanaco dataset using Flash Attention 2
# import torch
# from transformers import AutoTokenizer, AutoModelForCausalLM
# model_id = "andrewrreed/falcon-7b-guanaco-qlora-arr"
# tokenizer = AutoTokenizer.from_pretrained(model_id)
# model = AutoModelForCausalLM.from_pretrained(model_id,
# torch_dtype=torch.bfloat16,
# load_in_4bit=True,
# )
@trinhtuanvubk
trinhtuanvubk / Download-Audio-from-YouTube.md
Created September 28, 2023 04:28 — forked from lelinhtinh/Download-Audio-from-YouTube.md
Tải nhạc từ Youtube dùng Youtube-DL

Tải nhạc từ Youtube

Cài đặt

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
sudo apt install ffmpeg

Sử dụng

@trinhtuanvubk
trinhtuanvubk / cuda_install.md
Created September 15, 2023 01:05 — forked from denguir/cuda_install.md
Installation procedure for CUDA & cuDNN

How to install CUDA & cuDNN on Ubuntu 22.04

Install NVIDIA drivers

Update & upgrade

sudo apt update && sudo apt upgrade

Remove previous NVIDIA installation

@trinhtuanvubk
trinhtuanvubk / cuda_install.md
Created September 15, 2023 01:05 — forked from denguir/cuda_install.md
Installation procedure for CUDA & cuDNN

How to install CUDA & cuDNN on Ubuntu 22.04

Install NVIDIA drivers

Update & upgrade

sudo apt update && sudo apt upgrade

Remove previous NVIDIA installation

"""
Examples:
(1) python benchmark_distilled_sd.py --pipeline_id CompVis/stable-diffusion-v1-4
(2) python benchmark_distilled_sd.py --pipeline_id CompVis/stable-diffusion-v1-4 --vae_path sayakpaul/taesd-diffusers
(3) python benchmark_distilled_sd.py --pipeline_id nota-ai/bk-sdm-small
(4) python benchmark_distilled_sd.py --pipeline_id nota-ai/bk-sdm-small --vae_path sayakpaul/taesd-diffusers
"""
import argparse
import time