Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 12, 2024
1 parent fe66455 commit 13fea49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions thunder/executors/torch_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def make_compiled(
region_trace = TraceCtx(None)
region_trace.args = sorted_unique_inputs
region_trace.kwargs = {}
region_trace.names = set([a.name for a in region_trace.args])
region_trace.names = {a.name for a in region_trace.args}
with tracectx(region_trace):
for a in sorted_unique_inputs:
prims.unpack_trivial(a, name=a.name)
Expand All @@ -86,7 +86,12 @@ def make_compiled(
if o is not None:
region_trace.add_name(o.name)
for sbsym in bsym.subsymbols:
list(map(lambda o: region_trace.add_name(o.name), filter(lambda o: o is not None and o.name not in region_trace.names, sbsym.flat_outs)))
list(
map(
lambda o: region_trace.add_name(o.name),
filter(lambda o: o is not None and o.name not in region_trace.names, sbsym.flat_outs),
)
)

# maybe make this the default if no sig info is present?
region_trace._siginfo = SigInfo("to_be_compiled")
Expand Down
6 changes: 4 additions & 2 deletions thunder/tests/test_torch_compile_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ def fn(a):
jfn = thunder.jit(fn, executors=(thunder.executors.torch_compile.torch_compile_ex,))
assert_close(jfn(a), fn(a))


@pytest.mark.skipif(not is_inductor_supported(), reason="inductor unsupported")
@requiresCUDA
@pytest.mark.skipif(not device_supports_bf16(torch.device("cuda")), reason="bf16 is not supported")
def test_litgpt_fabric_for_callable():
from typing import Any, Callable, Optional, Tuple, Union, List, Dict
from typing import Any, Optional, Tuple, Union, List, Dict
from collections.abc import Callable
from litgpt.model import Config, GPT
import torch.nn as nn

def jit(fn: Callable, executors: List[str]) -> Any:
def jit(fn: Callable, executors: list[str]) -> Any:
assert executors is not None
return thunder.jit(fn, executors=executors)

Expand Down

0 comments on commit 13fea49

Please sign in to comment.