Merge branch 'main' into 'main'

Improve support for non-openai models and fix index out of range bug

See merge request DazedAnon/DazedMTLTool!16
This commit is contained in:
DazedAnon 2024-12-30 18:54:39 +00:00
commit 8ca4d608c1
23 changed files with 128 additions and 18 deletions

View file

@ -30,4 +30,16 @@ width="60"
listWidth="100"
#The wordwap of items and help text
noteWidth="75"
noteWidth="75"
# Custom input API cost - default value for gpt-3.5, replace with your actual input API cost - depends on the model, see https://openai.com/pricing
input_cost= 0.002
# Custom output API cost - default value for gpt-3.5, replace with your actual input API cost - depends on the model, see https://openai.com/pricing
output_cost= 0.002
# Batch size - adjust according to your API's limitations
batchsize="10"
# Frequency penalty - adjust according to your needs
frequency_penalty= 0.2

View file

@ -57,7 +57,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.01
OUTPUTAPICOST = 0.03
BATCHSIZE = 1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleAlice(filename, estimate):
global ESTIMATE

View file

@ -58,7 +58,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.01
OUTPUTAPICOST = 0.03
BATCHSIZE = 50
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleAnim(filename, estimate):
global ESTIMATE

View file

@ -57,6 +57,11 @@ elif "gpt-4" in MODEL:
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
FREQUENCY_PENALTY = 0.1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
# tqdm Globals
BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"

View file

@ -58,7 +58,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleEushully(filename, estimate):
global ESTIMATE

View file

@ -52,6 +52,11 @@ elif "gpt-4" in MODEL:
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
FREQUENCY_PENALTY = 0.1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
# tqdm Globals
BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"

View file

@ -57,7 +57,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleIris(filename, estimate):
global ESTIMATE

View file

@ -57,7 +57,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleJavascript(filename, estimate):
global ESTIMATE

View file

@ -58,7 +58,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.01
OUTPUTAPICOST = 0.03
BATCHSIZE = 50
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleJSON(filename, estimate):
global ESTIMATE, totalTokens

View file

@ -57,7 +57,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.01
OUTPUTAPICOST = 0.03
BATCHSIZE = 10
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleKansen(filename, estimate):
global ESTIMATE

View file

@ -65,7 +65,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleKirikiri(filename, estimate):
global ESTIMATE, FILENAME

View file

@ -60,6 +60,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.01
OUTPUTAPICOST = 0.03
BATCHSIZE = 50
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleLune(filename, estimate):

View file

@ -66,6 +66,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleOnscripter(filename, estimate):

View file

@ -60,6 +60,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleRegex(filename, estimate):

View file

@ -60,6 +60,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleRenpy(filename, estimate):

View file

@ -62,6 +62,11 @@ elif "gpt-4" in MODEL:
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
FREQUENCY_PENALTY = 0.1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
# tqdm Globals
BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"

View file

@ -59,6 +59,11 @@ elif "gpt-4" in MODEL:
OUTPUTAPICOST = 0.01
BATCHSIZE = 30
FREQUENCY_PENALTY = 0.1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
# tqdm Globals
BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"
@ -651,10 +656,11 @@ def searchNames(data, pbar, context):
totalTokens[1] += response[1][1]
# Profile
response = translateGPT(profileList, "", True)
translatedProfileBatch = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
if profileList:
response = translateGPT(profileList, "", True)
translatedProfileBatch = response[0]
totalTokens[0] += response[1][0]
totalTokens[1] += response[1][1]
# Set Data
if len(nameList) == len(translatedNameBatch):

View file

@ -59,7 +59,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handlePlugin(filename, estimate):
global ESTIMATE, PBAR

View file

@ -60,7 +60,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 30
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleText(filename, estimate):
global ESTIMATE, TOKENS, FILENAME

View file

@ -60,7 +60,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleTyrano(filename, estimate):
global ESTIMATE, TOKENS, FILENAME

View file

@ -66,7 +66,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleUnity(filename, estimate):
global ESTIMATE, FILENAME

View file

@ -59,6 +59,11 @@ elif "gpt-4" in MODEL:
OUTPUTAPICOST = 0.01
BATCHSIZE = 20
FREQUENCY_PENALTY = 0.1
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
# tqdm Globals
BAR_FORMAT = "{l_bar}{bar:10}{r_bar}{bar:-10b}"

View file

@ -58,7 +58,11 @@ elif "gpt-4" in MODEL:
INPUTAPICOST = 0.0025
OUTPUTAPICOST = 0.01
BATCHSIZE = 40
else:
INPUTAPICOST = float(os.getenv("input_cost"))
OUTPUTAPICOST = float(os.getenv("output_cost"))
BATCHSIZE = int(os.getenv("batchsize"))
FREQUENCY_PENALTY = float(os.getenv("frequency_penalty"))
def handleWOLF2(filename, estimate):
global ESTIMATE