mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-11 13:59:08 +00:00
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit * [misc] run pre-commit * [misc] remove useless configuration files * [misc] ignore cuda for clang-format
This commit is contained in:
@@ -10,15 +10,14 @@ JIT_OPTIONS_SET = False
|
||||
|
||||
|
||||
def set_jit_fusion_options():
|
||||
"""Set PyTorch JIT layer fusion options.
|
||||
"""
|
||||
"""Set PyTorch JIT layer fusion options."""
|
||||
# LSG: the latest pytorch and CUDA versions may not support
|
||||
# the following jit settings
|
||||
global JIT_OPTIONS_SET
|
||||
if JIT_OPTIONS_SET == False:
|
||||
# flags required to enable jit fusion kernels
|
||||
TORCH_MAJOR = int(torch.__version__.split('.')[0])
|
||||
TORCH_MINOR = int(torch.__version__.split('.')[1])
|
||||
TORCH_MAJOR = int(torch.__version__.split(".")[0])
|
||||
TORCH_MINOR = int(torch.__version__.split(".")[1])
|
||||
if (TORCH_MAJOR > 1) or (TORCH_MAJOR == 1 and TORCH_MINOR >= 10):
|
||||
# nvfuser
|
||||
torch._C._jit_set_profiling_executor(True)
|
||||
@@ -38,12 +37,14 @@ def set_jit_fusion_options():
|
||||
JIT_OPTIONS_SET = True
|
||||
|
||||
|
||||
def warmup_jit_fusion(batch_size: int,
|
||||
hidden_size: int,
|
||||
seq_length: int = 512,
|
||||
vocab_size: int = 32768,
|
||||
dtype: torch.dtype = torch.float32):
|
||||
""" Compile JIT functions before the main training steps """
|
||||
def warmup_jit_fusion(
|
||||
batch_size: int,
|
||||
hidden_size: int,
|
||||
seq_length: int = 512,
|
||||
vocab_size: int = 32768,
|
||||
dtype: torch.dtype = torch.float32,
|
||||
):
|
||||
"""Compile JIT functions before the main training steps"""
|
||||
|
||||
embed = Embedding(vocab_size, hidden_size).to(get_current_device())
|
||||
linear_1 = Linear(hidden_size, hidden_size * 4, skip_bias_add=True).to(get_current_device())
|
||||
|
Reference in New Issue
Block a user