You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to test the output of a certain dataset under LLama 3.1 and I wrote a python script: input the dataset, receive the output of the model and save it to a file, and so on.
process = subprocess.Popen(
[llama_cli_path, '-m', model_path, '-i'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True,
bufsize=1,
)
try:
with open("model_output.txt", "w") as output_file:
for sentence in dataset:
process.stdin.write(sentence+'\n')
process.stdin.flush()
response_lines = []
while True:
line = process.stdout.readline()
if not line:
break
if "<EOS>" in line:
break
response_lines.append(line.strip())
output_file.write("\n".join(sentence)+ "\n")
output_file.write("\n".join(response_lines)+ "\n")
finally:
process.stdin.close()
process.terminate()
process.wait()
print("Process terminated.")
But unfortunately this script didn't work as expected. What is the problem? The problem seems to me to be that there is no way to tell when the model has finished outputting。 Or if I want to test a certain dataset in llama.cpp, is there a better way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I wanted to test the output of a certain dataset under LLama 3.1 and I wrote a python script: input the dataset, receive the output of the model and save it to a file, and so on.
But unfortunately this script didn't work as expected. What is the problem? The problem seems to me to be that there is no way to tell when the model has finished outputting。 Or if I want to test a certain dataset in llama.cpp, is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions