Update inference_1.py
Browse files- inference_1.py +2 -1
inference_1.py
CHANGED
|
@@ -92,6 +92,7 @@ def main():
|
|
| 92 |
parser.add_argument("--mode", choices=["single", "chat", "batch"], default="single", help="Inference mode")
|
| 93 |
parser.add_argument("--prompt", help="Prompt for single inference mode")
|
| 94 |
parser.add_argument("--prompt_file", help="File containing prompts for batch mode (one per line)")
|
|
|
|
| 95 |
args = parser.parse_args()
|
| 96 |
|
| 97 |
# Initialize the model
|
|
@@ -132,7 +133,7 @@ def main():
|
|
| 132 |
print(f"Running batch inference on {len(prompts)} prompts...")
|
| 133 |
responses = batch_inference(llm, prompts)
|
| 134 |
|
| 135 |
-
with open(
|
| 136 |
json.dump(responses, final)
|
| 137 |
|
| 138 |
if __name__ == "__main__":
|
|
|
|
| 92 |
parser.add_argument("--mode", choices=["single", "chat", "batch"], default="single", help="Inference mode")
|
| 93 |
parser.add_argument("--prompt", help="Prompt for single inference mode")
|
| 94 |
parser.add_argument("--prompt_file", help="File containing prompts for batch mode (one per line)")
|
| 95 |
+
parser.add_argument("--output_file", help="Path to save JSON results (default: auto-generated)")
|
| 96 |
args = parser.parse_args()
|
| 97 |
|
| 98 |
# Initialize the model
|
|
|
|
| 133 |
print(f"Running batch inference on {len(prompts)} prompts...")
|
| 134 |
responses = batch_inference(llm, prompts)
|
| 135 |
|
| 136 |
+
with open(args.output_file, "w") as final:
|
| 137 |
json.dump(responses, final)
|
| 138 |
|
| 139 |
if __name__ == "__main__":
|