This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# client_v4.py | |
""" | |
Message Box MCP Client | |
インストール方法等はserver_v4.pyを参照。 | |
## 使用法 | |
メッセージ取得: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ライセンスは Apache License 2.0 です。 | |
# お勧めのオプションは: | |
# --flash_attn --q8_kv_cache --n_gpu_layers <GPUのVRAMに応じて> --n_ctx <VRAMとモデルのcontext lengthに応じて> | |
import argparse | |
import random | |
import msvcrt # Windowsの場合 | |
import toml | |
from typing import List, Optional, Union, Iterator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License: Apache 2.0 | |
import io | |
import struct | |
import json | |
import torch | |
class MemoryEfficientSafeOpen: | |
# does not support metadata loading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache License 2.0 | |
# 使用法は gist のコメントを見てください | |
import time | |
import argparse | |
import os | |
import json | |
import tomli | |
import traceback | |
from typing import Any, Dict, List, Optional, Union, Iterator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache License 2.0 | |
# 使用法は gist のコメントを見てください | |
import argparse | |
import importlib | |
import json | |
import os | |
import random | |
import time | |
import traceback | |
import tomli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 仮に logs に入れたら以下のように指定 | |
# --lr_scheduler_type logs.stepwise_linear_decay_lr_scheduler.get_stepwise_linear_decay_lr_scheduler | |
# --lr_scheduler_args "step_a=50" "step_b=80" "factor_1=1.0" "factor_2=0.1" | |
# | |
# step_a までの学習率: 指定した learning_rate * factor_1 | |
# step_a から step_b まで: 線形に減少(増加) | |
# step_b からの学習率: 指定した learning_rate * factor_2 | |
from torch.optim.lr_scheduler import LambdaLR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import csv | |
import glob | |
import os | |
from pathlib import Path | |
import cv2 | |
import numpy as np | |
import torch | |
from PIL import Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dart v2を用いて sd-scripts の gen_img.py 用のプロンプトファイルを作成するスクリプト | |
import random | |
import torch | |
from transformers import AutoModelForCausalLM, AutoTokenizer | |
# Rating tag: <|rating:sfw|>, <|rating:general|>, <|rating:sensitive|>, nsfw, <|rating:questionable|>, <|rating:explicit|> | |
# Aspect ratio tag: <|aspect_ratio:ultra_wide|>, <|aspect_ratio:wide|>, <|aspect_ratio:square|>, <|aspect_ratio:tall|>, <|aspect_ratio:ultra_tall|> | |
# Length tag: <|length:very_short|>, <|length:short|>, <|length:medium|>, <|length:long|>, <|length:very_long|> | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache License 2.0 | |
# 使用法は gist のコメントを見てください | |
import argparse | |
from typing import List, Optional, Union, Iterator | |
from llama_cpp import Llama | |
from llama_cpp.llama_tokenizer import LlamaHFTokenizer | |
from llama_cpp.llama_chat_format import _convert_completion_to_chat, register_chat_completion_handler | |
import llama_cpp.llama_types as llama_types |
NewerOlder