Skip to content

Commit 71b2e7d

Browse files
authored
replace 'cache_mode' option in tests with 'cache' (#2744)
1 parent 93aa254 commit 71b2e7d

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

thunder/tests/distributed/test_ddp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get_model_and_optimizer(device):
165165
m = ToyModel().to(device)
166166
jitted_m = thunder.jit(
167167
m,
168-
cache_mode=CACHE_OPTIONS.CONSTANT_VALUES,
168+
cache=CACHE_OPTIONS.CONSTANT_VALUES,
169169
executors=executors_map[executor].executors_list(),
170170
)
171171
jitted_ddp_m = ddp(jitted_m, bucket_size_in_mb=bucket_size_in_mb)

thunder/tests/distributed/test_fsdp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_model_and_optimizer(device):
137137
m = ToyModel().to(device)
138138
jitted_m = thunder.jit(
139139
m,
140-
cache_mode=CACHE_OPTIONS.CONSTANT_VALUES,
140+
cache=CACHE_OPTIONS.CONSTANT_VALUES,
141141
executors=executors_map[executor].executors_list(),
142142
)
143143
jitted_fsdp_m = fsdp(jitted_m, bucketing_strategy=bucketing_strategy, sharding_strategy=fsdptype)

thunder/tests/test_core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def test_static_caching(executor, device: str, dtype: dtypes.dtype):
827827
def foo(a, b):
828828
return a + b
829829

830-
cfoo = thunder.jit(foo, cache_mode="constant values")
830+
cfoo = thunder.jit(foo, cache="constant values")
831831

832832
assert cache_option(cfoo) == thunder.CACHE_OPTIONS.CONSTANT_VALUES
833833

@@ -894,7 +894,7 @@ def foo(a, b):
894894
def bar(a, b):
895895
return a, b
896896

897-
cbar = thunder.jit(bar, cache_mode="constant values")
897+
cbar = thunder.jit(bar, cache="constant values")
898898

899899
astr = "a"
900900
bstr = "b"
@@ -928,7 +928,7 @@ def bar(a, b):
928928

929929
# Module tests
930930
m = torch.nn.Linear(5, 5, device=device, dtype=torch_dtype)
931-
cm = thunder.jit(m, cache_mode="constant values")
931+
cm = thunder.jit(m, cache="constant values")
932932

933933
inp = make_tensor((5, 5), device=device, dtype=torch_dtype)
934934

@@ -979,7 +979,7 @@ def caz(tup):
979979
accum += x
980980
return accum
981981

982-
ccaz = thunder.jit(caz, cache_mode="constant values")
982+
ccaz = thunder.jit(caz, cache="constant values")
983983

984984
inp0 = [5, 3, 7]
985985
thunder_result = ccaz(inp0)
@@ -1026,7 +1026,7 @@ def caz(tup):
10261026
def daz(*, a, b):
10271027
return a + b
10281028

1029-
cdaz = thunder.jit(daz, cache_mode="constant values")
1029+
cdaz = thunder.jit(daz, cache="constant values")
10301030

10311031
inp0 = {"a": a, "b": b}
10321032
thunder_result = cdaz(**inp0)

thunder/tests/test_grad.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,11 +1336,11 @@ def test_torch_autograd_module(executor, device, _):
13361336
a = make_tensor((2, 3), device=device, dtype=torch.float32, requires_grad=True)
13371337
g = make_tensor((2, 4), device=device, dtype=torch.float32)
13381338

1339-
for cache_mode in ("constant values", "same input"):
1339+
for cache_mode in ("constant values", "no caching"):
13401340
lc = executor.make_callable(
13411341
linear,
13421342
disable_torch_autograd=False,
1343-
cache_mode=cache_mode,
1343+
cache=cache_mode,
13441344
)
13451345
lc.zero_grad()
13461346
a.grad = None

0 commit comments

Comments
 (0)