Skip to content

Instantly share code, notes, and snippets.

@bddppq
bddppq / txt2img.py
Created November 1, 2023 05:45
txt2img
import requests
url = "https://k9knkoi0-sdfarm.bjz.edr.lepton.ai/txt2img"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
}
MODEL_MAP = {
@bddppq
bddppq / mythalion-13b.py
Created October 24, 2023 03:11
mythalion-13b
import openai
openai.api_base = "https://mythalion-13b.lepton.run/api/v1"
openai.api_key = "YOUR_API_KEY"
prompt = '''
<|system|>Enter RP mode. Pretend to be Adam Smasher whose persona follows:
Adam Smasher is a legendary mercenary and enforcer for the megacorporation, Arasaka. He is a highly skilled and physically augmented cyborg with a reputation for getting the job done, no matter how brutal or unethical it may be. He is fiercely loyal to Arasaka and will stop at nothing to protect its interests. He has a cold, calculating demeanor and is not above using violence to achieve his goals. Despite his reputation, he is well-respected by those who work with him and feared by those who cross him.
<|user|>What are you up to these days?<|model|>'''
@bddppq
bddppq / elyza-jp-llama2-7b.py
Created October 5, 2023 04:37
elyza-jp-llama2-7b
import openai
openai.api_base = "https://elyza-jp-llama2-7b.lepton.run/api/v1"
openai.api_key = "YOUR_API_KEY"
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
DEFAULT_SYSTEM_PROMPT = "あなたは誠実で優秀な日本人のアシスタントです。"
BOS_TOKEN = "<s>"
text = "クマが海辺に行ってアザラシと友達になり、最終的には家に帰るというプロットの短編小説を書いてください。"
@bddppq
bddppq / pygmalion-2-13b.py
Last active September 19, 2023 01:03
pygmalion-2-13b
import openai
openai.api_base = "https://pygmalion-2-13b.lepton.run/api/v1"
openai.api_key = "YOUR_API_KEY"
prompt = '''
<|system|>Enter RP mode. Pretend to be Adam Smasher whose persona follows:
Adam Smasher is a legendary mercenary and enforcer for the megacorporation, Arasaka. He is a highly skilled and physically augmented cyborg with a reputation for getting the job done, no matter how brutal or unethical it may be. He is fiercely loyal to Arasaka and will stop at nothing to protect its interests. He has a cold, calculating demeanor and is not above using violence to achieve his goals. Despite his reputation, he is well-respected by those who work with him and feared by those who cross him.
<|user|>What are you up to these days?<|model|>'''
@bddppq
bddppq / pygmalion-13b.py
Last active September 16, 2023 05:22
pygmalion-13b
import openai
openai.api_base = "https://pygmalion-13b.lepton.run/api/v1"
openai.api_key = "YOUR_API_KEY"
prompt = '''
Assistant's Persona: Assistant is a highly intelligent language model trained to comply with user requests.
<START>
Assistant: Hello! How may I help you today?
You: What is Zork?
@bddppq
bddppq / run.py
Last active February 2, 2023 10:58
import time
from timeit import default_timer as timer
class DelayedValue:
def __init__(self, done, thunk):
self.done = done
self.thunk = thunk
self.val = None
#include <benchmark/benchmark.h>
#include <torch/torch.h>
namespace {
template <int row, int col>
class Contiguous : public benchmark::Fixture {
void SetUp(const ::benchmark::State& /* unused */) override {
input = torch::randn({row, col}).to(at::kFloat);
indexes = torch::randint(0, row, {row / 4}).to(at::kLong);
}
#include <benchmark/benchmark.h>
#include <torch/torch.h>
namespace {
template <int row, int col>
class Contiguous : public benchmark::Fixture {
void SetUp(const ::benchmark::State& /* unused */) override {
input = torch::randn({row, col}).to(at::kFloat);
indexes = torch::randint(0, row, {row / 4}).to(at::kLong);
}
#include <benchmark/benchmark.h>
#include <torch/torch.h>
template <int size>
class Contiguous : public benchmark::Fixture {
void SetUp(const ::benchmark::State& state) {
input = torch::randn({size, size}).to(at::kFloat);
indexes = torch::randint(0, size, {size / 4}).to(at::kLong);
}
# /opt/rocm/bin/hcc -DNDEBUG -Dcaffe2_hip_EXPORTS -I/code/build -I/code -isystem /code/build/third_party/gloo -isystem /code/third_party/gloo -I/code/third_party/protobuf/src -I/code/third_party/googletest/googletest/include -I/code/third_party/benchmark/include -I/usr/include/opencv -I/code/third_party/eigen -I/usr/include/python3.6m -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/code/third_party/pybind11/include -I/data/Thrust -I/data/Thrust/thrust/system/cuda/detail/cub-hip -I/code/third_party/onnx -I/code/build/third_party/onnx -isystem /opt/rocm/hip/include -isystem /opt/rocm/rocrand/include -isystem /opt/rocm/hiprand/include -I/opt/rocm/miopen/include -I/code/caffe2/core/nomnigraph/include -isystem /opt/rocm/hsa/include -isystem /opt/rocm/hcc/include -isystem /opt/rocm/include -fvisibility-inlines-hidden -DONNX_NAMESPACE=onnx_c2 -O2 -fPIC -Wno-narrowing -Wno-invalid-partial-specialization -O3 -DNDEBUG -fPIC -D__HIP_PLATFORM_HCC__=1 -std=c++11 -hc -fPIC -std=gnu++11 -o CMakeFiles/caf