Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codeflash/api/aiservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def get_jit_rewritten_code( # noqa: D417
logger.info("!lsp|Rewriting as a JIT function…")
console.rule()
try:
response = self.make_ai_service_request("/rewrite_jit", payload=payload, timeout=60)
response = self.make_ai_service_request("/rewrite_jit", payload=payload, timeout=self.timeout)
except requests.exceptions.RequestException as e:
logger.exception(f"Error generating jit rewritten candidate: {e}")
ph("cli-jit-rewrite-error-caught", {"error": str(e)})
Expand Down
3 changes: 3 additions & 0 deletions codeflash/cli_cmds/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def parse_args() -> Namespace:
parser.add_argument(
"--no-gen-tests", action="store_true", help="Do not generate tests, use only existing tests for optimization."
)
parser.add_argument(
"--no-jit-opts", action="store_true", help="Do not generate JIT-compiled optimizations for numerical code."
)
parser.add_argument("--staging-review", action="store_true", help="Upload optimizations to staging for review")
parser.add_argument(
"--verify-setup",
Expand Down
8 changes: 5 additions & 3 deletions codeflash/optimization/function_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@ def optimize_function(self) -> Result[BestOptimization, str]:
):
console.rule()
new_code_context = code_context
if self.is_numerical_code: # if the code is numerical in nature (uses numpy/tensorflow/math/pytorch/jax)
if (
self.is_numerical_code and not self.args.no_jit_opts
): # if the code is numerical in nature (uses numpy/tensorflow/math/pytorch/jax)
jit_compiled_opt_candidate = self.aiservice_client.get_jit_rewritten_code(
code_context.read_writable_code.markdown, self.function_trace_id
)
Expand Down Expand Up @@ -639,7 +641,7 @@ def optimize_function(self) -> Result[BestOptimization, str]:
read_writable_code=code_context.read_writable_code,
read_only_context_code=code_context.read_only_context_code,
run_experiment=should_run_experiment,
is_numerical_code=self.is_numerical_code,
is_numerical_code=self.is_numerical_code and not self.args.no_jit_opts,
)

concurrent.futures.wait([future_tests, future_optimizations])
Expand Down Expand Up @@ -1158,7 +1160,7 @@ def determine_best_candidate(
)
if self.experiment_id
else None,
is_numerical_code=self.is_numerical_code,
is_numerical_code=self.is_numerical_code and not self.args.no_jit_opts,
)

processor = CandidateProcessor(
Expand Down
Loading