Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nwangfw committed Feb 25, 2025
1 parent caa40cb commit 95c07c0
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import argparse
import json
import os
import threading
import time
from typing import Any, Dict, List, Optional, Tuple

import requests
from typing import Tuple, List, Optional, Dict, Union, Any
from datetime import datetime
import threading
import argparse
import tiktoken
import os


def get_tokenizer(
pretrained_model_name_or_path: str, trust_remote_code: bool
Expand Down Expand Up @@ -93,7 +94,7 @@ def find_matching_prompts(self, target_input_tokens: int, min_output_tokens: int
input_min = int(target_input_tokens * (1 - input_tolerance))
input_max = int(target_input_tokens * (1 + input_tolerance))

print(f"Scanning trace file for candidates...")
print("Scanning trace file for candidates...")
print(f"Input token range: {input_min} - {input_max}")

# First pass: collect all candidates based on input length
Expand All @@ -109,7 +110,7 @@ def find_matching_prompts(self, target_input_tokens: int, min_output_tokens: int
input_diff = abs(input_tokens - target_input_tokens)
candidates.append((prompt, input_tokens, input_diff))

except (json.JSONDecodeError, Exception) as e:
except (json.JSONDecodeError, Exception):
continue

# Sort candidates by input difference
Expand Down Expand Up @@ -212,7 +213,7 @@ def main():
args = parse_args()
start_time = time.time()

print(f"\nStarting prompt search with parameters:")
print("\nStarting prompt search with parameters:")
print(f"Target input tokens: {args.input_tokens}")
print(f"Minimum output tokens: {args.min_output_tokens}")
print(f"Tolerance: {args.tolerance}")
Expand Down

0 comments on commit 95c07c0

Please sign in to comment.