Skip to content

Instantly share code, notes, and snippets.

@mutaguchi
mutaguchi / 00_LLM_translator.md
Last active May 28, 2024 23:30
LLM_translator.py

llama.cpp serverを使って、入力文字列を翻訳するスクリプト。

使用方法

python LLM_Translator.py 
[-h] 
[-i 入力ファイルパス] [-o 出力ファイルパス] [-p プロンプトファイルパス] [-d 辞書ファイルパス] 
[-u llama.cpp serverのURL] [--quiet] [--no-outfile] [--include-input] [--min-context-count 最小保持ターン数]
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 8, 2025 07:28
ローカルLLMはこーやって使うの💢
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kohya-ss
kohya-ss / gradio_llm.py
Last active September 1, 2024 22:02
gradioでLLMを利用する簡易クライアント
# Apache License 2.0
# 使用法は gist のコメントを見てください
import argparse
from typing import List, Optional, Union, Iterator
import llama_cpp
from llama_cpp.llama_chat_format import _convert_completion_to_chat, register_chat_completion_handler
import llama_cpp.llama_types as llama_types
from llama_cpp.llama import LogitsProcessorList, LlamaGrammar
from llama_cpp import Llama, llama_chat_format
@alfredplpl
alfredplpl / gemma_finetune_lora.py
Created February 24, 2024 04:23
Gemma初心者ファインチューニングコードです。HFの設定などはよしなにやってください。
# Reference #1: https://note.com/npaka/n/nc55e44e407ff
# Reference #2: https://huggingface.co/blog/gemma-peft
# Licence: MIT
from peft import LoraConfig
lora_config = LoraConfig(
r=8,
target_modules=["q_proj", "o_proj", "k_proj", "v_proj", "gate_proj", "up_proj", "down_proj"],
task_type="CAUSAL_LM",
@virattt
virattt / private_rag-reranking-gpt-colbert-mistral-cohere.ipynb
Created January 29, 2024 22:27
reranking-gpt-colbert-mistral-cohere.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@virattt
virattt / langgraph-financial-agent-polygon.ipynb
Created January 25, 2024 22:35
Langgraph-financial-agent-polygon.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyo-takano
kyo-takano / lexical_search_with_gzip.py
Last active March 11, 2024 03:39
Lexical Search with gzip (gzipによる語彙検索)
import gzip
def gzip_search(query: str, candidate_chunks: list[str], top_k: int=1):
"""
文字列ベースで類似したテキストチャンクを推定するアルゴリズム.
`query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し編集距離のようなものをベースに評価する.
Parameters:
query (str): 検索クエリとして使用する文字列.
top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 1).
@VTSTech
VTSTech / VTSTech-GPT.py
Last active January 28, 2025 18:02
VTSTech-GPT - Generate text with Cerebras GPT pretrained and Corianas finetuned models
# Program: VTSTech-GPT.py 2025-01-28 1:02:59 PM
# Description: Python script that generates text with Cerebras GPT pretrained and Corianas finetuned models
# Author: Written by Veritas//VTSTech ([email protected])
# GitHub: https://github.com/VTSTech
# Homepage: www.VTS-Tech.org
# Dependencies: transformers, colorama, Flask
# pip install transformers colorama flask
# Models are stored at C:\Users\%username%\.cache\huggingface\hub
import argparse
import time
@danielgross
danielgross / ai-plugin.json
Created March 23, 2023 22:59
ChatGPT Plugin for Twilio
{
"schema_version": "v1",
"name_for_model": "twilio",
"name_for_human": "Twilio Plugin",
"description_for_model": "Plugin for integrating the Twilio API to send SMS messages and make phone calls. Use it whenever a user wants to send a text message or make a call using their Twilio account.",
"description_for_human": "Send text messages and make phone calls with Twilio.",
"auth": {
"type": "user_http",
"authorization_type": "basic"
},
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()