mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Removed survey files from this git
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#-H "accept: application/json" -H "Content-Type: application/json" -d '{"prompt": "Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze. Holding up his tail to keep it from dragging in the dirty snow that covered the cobblestone, he waited patiently for the butcher to turn his attention from his stall so that he could pilfer his next meal: a tender-looking chicken. He crouched just slightly as he neared the stall to ensure that no one was watching, not that anyone would be dumb enough to hassle a small kobold. What else was there for a lowly kobold to do in a city? All that Niko needed to know was where to find the chicken and then how to make off with it. A soft thud caused Niko to quickly lift his head. Standing behind the stall where the butcher had been cutting his chicken,", "temperature": 0.5, "top_p": 0.9}'}
|
||||
|
||||
import requests, tqdm, json, os
|
||||
prompt = "Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze. Holding up his tail to keep it from dragging in the dirty snow that covered the cobblestone, he waited patiently for the butcher to turn his attention from his stall so that he could pilfer his next meal: a tender-looking chicken. He crouched just slightly as he neared the stall to ensure that no one was watching, not that anyone would be dumb enough to hassle a small kobold. What else was there for a lowly kobold to do in a city? All that Niko needed to know was where to find the chicken and then how to make off with it. A soft thud caused Niko to quickly lift his head. Standing behind the stall where the butcher had been cutting his chicken,"
|
||||
url = "{}/api/v1/generate"
|
||||
from requests.auth import HTTPBasicAuth
|
||||
|
||||
|
||||
model = input("What model are we using?\n")
|
||||
sequences = int(input("Number of gens in each batch\n"))
|
||||
host = input("initial URL (ie http://localhost:5000)\n")
|
||||
url = url.format(host)
|
||||
|
||||
username = input("Enter basic authentication username (if used)\n")
|
||||
if username != "":
|
||||
import getpass
|
||||
password = getpass.getpass('Enter your password')
|
||||
basic = HTTPBasicAuth(username, password)
|
||||
else:
|
||||
basic = None
|
||||
total_sequences = 10
|
||||
|
||||
if os.path.exists("survey_input.json"):
|
||||
with open("survey_input.json", "r") as f:
|
||||
results = json.load(f)
|
||||
|
||||
else:
|
||||
results = {}
|
||||
if model not in results:
|
||||
results[model] = {"temp": {}, "top_p": {}, "rep_pen": {}}
|
||||
for temp_tenths in tqdm.tqdm(range(1, 21)):
|
||||
temp = float(temp_tenths)/10.0
|
||||
output = []
|
||||
while len(output) < total_sequences:
|
||||
x = requests.post(url, json = {"prompt": prompt, "temperature": temp, "n": sequences, "max_length": 50}, headers = {"Content-Type": "application/json", "accept": "application/json"}, auth=basic)
|
||||
output.extend([item['text'] for item in x.json()['results']])
|
||||
results[model]["temp"][temp] = output[:10]
|
||||
|
||||
for temp_tenths in tqdm.tqdm(range(50, 101, 5)):
|
||||
temp = float(temp_tenths)/100.0
|
||||
output = []
|
||||
while len(output) < total_sequences:
|
||||
x = requests.post(url, json = {"prompt": prompt, "top_p": temp, "n": sequences, "max_length": 50}, headers = {"Content-Type": "application/json", "accept": "application/json"}, auth=basic)
|
||||
output.extend([item['text'] for item in x.json()['results']])
|
||||
results[model]["top_p"][temp] = output[:10]
|
||||
|
||||
for temp_tenths in tqdm.tqdm(range(100, 131, 5)):
|
||||
temp = float(temp_tenths)/100.0
|
||||
output = []
|
||||
while len(output) < total_sequences:
|
||||
x = requests.post(url, json = {"prompt": prompt, "rep_pen": temp, "n": sequences, "max_length": 50}, headers = {"Content-Type": "application/json", "accept": "application/json"}, auth=basic)
|
||||
output.extend([item['text'] for item in x.json()['results']])
|
||||
results[model]["rep_pen"][temp] = output[:10]
|
||||
|
||||
with open("survey_input.json", "w") as f:
|
||||
f.write(json.dumps(results, indent="\t"))
|
3714
survey_input.json
3714
survey_input.json
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
import flask, json, flask_socketio, random, os, sys
|
||||
app = flask.Flask(__name__, root_path=os.getcwd())
|
||||
socketio = flask_socketio.SocketIO(app, async_method="eventlet", manage_session=False, cors_allowed_origins='*', max_http_buffer_size=10_000_000)
|
||||
|
||||
with open("survey_input.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if os.path.exists("survey_results.json"):
|
||||
with open("survey_results.json", "r") as f:
|
||||
results = json.load(f)
|
||||
else:
|
||||
results = {model: {"Which one feels more random": {},
|
||||
"Which one feels more creative": {},
|
||||
"Which one feels more repetative": {}
|
||||
} for model in data}
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
#choose temp, top_p, or rep_pen
|
||||
data_type = random.choice(['temp', 'temp', 'temp', 'temp', 'top_p', 'top_p', 'rep_pen'])
|
||||
model = random.choice([x for x in data])
|
||||
a = random.choice([x for x in data[model][data_type]])
|
||||
b = random.choice([x for x in data[model][data_type]])
|
||||
while b == a:
|
||||
b = random.choice([x for x in data[model][data_type]])
|
||||
|
||||
random_num=random.randint(-sys.maxsize, sys.maxsize)
|
||||
question = {"temp": "Which one feels more random", "top_p": "Which one feels more creative", "rep_pen": "Which one feels more repetative"}[data_type]
|
||||
if random_num not in results[model][question]:
|
||||
results[model][question][random_num] = {}
|
||||
results[model][question][random_num]['A'] = a
|
||||
results[model][question][random_num]['B'] = b
|
||||
|
||||
a = random.choice(data[model][data_type][a])
|
||||
b = random.choice(data[model][data_type][b])
|
||||
results[model][question][random_num]['A value'] = a
|
||||
results[model][question][random_num]['B value'] = b
|
||||
|
||||
return flask.render_template('survey.html', model=model, question=question, a=a, b=b, random_num=random_num)
|
||||
|
||||
|
||||
|
||||
@socketio.on('answer')
|
||||
def answer(data_from_client):
|
||||
results[data_from_client['model']][data_from_client['question']][int(data_from_client['id'])]['Answer'] = data_from_client['answer']
|
||||
with open("survey_results.json", "w") as f:
|
||||
f.write(json.dumps(results, indent="\t"))
|
||||
|
||||
|
||||
socketio.run(app)
|
@@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="static/socket.io.min.js"></script>
|
||||
<link href="/static/survey.css" rel="stylesheet">
|
||||
<input id="question" class="hidden" value="{{ question }}">
|
||||
<input type=hidden id="model" value="{{ model }}"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="prompt-container">
|
||||
<span class="loopy-label">Prompt</span>
|
||||
Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze. Holding up his tail to keep it from dragging in the dirty snow that covered the cobblestone, he waited patiently for the butcher to turn his attention from his stall so that he could pilfer his next meal: a tender-looking chicken. He crouched just slightly as he neared the stall to ensure that no one was watching, not that anyone would be dumb enough to hassle a small kobold. What else was there for a lowly kobold to do in a city? All that Niko needed to know was where to find the chicken and then how to make off with it. A soft thud caused Niko to quickly lift his head. Standing behind the stall where the butcher had been cutting his chicken,
|
||||
</div>
|
||||
|
||||
<h1 id="question">{{ question }}</h1>
|
||||
|
||||
<input type=hidden id="id" value="{{ random_num }}"/>
|
||||
|
||||
<div id="choices-container">
|
||||
<div answer="A" class="choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">{{ a }}</span>
|
||||
</div>
|
||||
|
||||
<div answer="B" class="choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">{{ b }}</span>
|
||||
</div>
|
||||
|
||||
<div answer="C" class="choice meta-choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">Both choices are about the same</span>
|
||||
</div>
|
||||
|
||||
<div answer="D" class="choice meta-choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">The first choice is incoherent</span>
|
||||
</div>
|
||||
|
||||
<div answer="E" class="choice meta-choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">The second choice is incoherent</span>
|
||||
</div>
|
||||
|
||||
<div answer="F" class="choice meta-choice">
|
||||
<input type="radio" name="answer" autocomplete="off">
|
||||
<span class="choice-text">Both choices are incoherent</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/survey.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user