I’m trying to do a few shot classification task, the prompt token is about 1400, and I want to classify a total of 300 input data.
However, it seems to take approximately 8 hours, and I don’t know why it takes so long.
ex) 4 data finished within 10sec. after 10 min 5 data finished within 10sec.
Intermittent delays occur.
input data: labelled dataset(.csv)
output data: .txt
python code below
for index, row in input.iterrows():
text = row[‘text_column’]
label = row[‘label_column’]
actual_labels.append(label)
# 4way-1shot #
response = openai.chat.completions.create(
model="gpt-3.5-turbo-1106",
temperature=0,
messages=[
{"role": "system", "content": " ~~ classification task ~~"},
{"role": "user", "content": "~~~~"},
{"role": "assistant", "content": "class 1"},
{"role": "user", "content": " ~~~~ "},
{"role": "assistant", "content": "class 2"},
{"role": "user", "content": " ~~~~ "},
{"role": "assistant", "content": "class 3"},
{"role": "user", "content": " ~~~~ "},
{"role": "assistant", "content": "class4"},
{"role": "user", "content": text}
]
)
predicted_label = response.choices[0].message.content.strip()
predicted_labels.append(predicted_label)
output_filename = f'{label}_{index+1}.txt'
with open(output_filename, 'w', encoding='utf-8-sig') as outfile:
response_text = json.dumps(response, indent=4, default=lambda x: x.__dict__)
outfile.write(response_text)