add torch.compile by default, shows almost 1.8X improvement in throughput nice
This commit is contained in:
1 parent
fb52554ca8
commit
5a725d9098
4 files changed
+19
-3
No files matched your search
@@ -14,7 +14,8 @@ torch.manual_seed(1337)
|
||||
|
||||
batch_size = 8
|
||||
block_size = 1024
|
||||
dtype = torch.float16
|
||||
dtype = torch.bfloat16
|
||||
compile_model = True
|
||||
|
||||
# data loading init
|
||||
real_data = True
|
||||
@@ -46,6 +47,10 @@ model.to(device)
|
||||
|
||||
optimizer = model.configure_optimizers(weight_decay=1e-2, learning_rate=1e-4, betas=(0.9, 0.95))
|
||||
|
||||
if compile_model:
|
||||
print("Compiling model...")
|
||||
model = torch.compile(model) # pytorch 2.0
|
||||
|
||||
profile = False # use pytorch profiler, or just simple benchmarking?
|
||||
if profile:
|
||||
# useful docs on pytorch profiler:
|
||||
|
||||
Reference in new issue
Block a user