MCPcopy Create free account
hub / github.com/cli99/llm-analysis / train

Function train

llm_analysis/analysis.py:2354–2503  ·  view source on GitHub ↗

Entry point function of training analysis for the command line interface. This uses pre-defined name-to-configuration mapping and common arguments to construct LLMAnalysis. Args: model_name (str, optional): model name to query the pre-defined `model_configs` dict, or model confi

(
    model_name="facebook_opt-1.3b",
    gpu_name="a100-sxm-40gb",
    dtype_name="w16a16e16",
    log_level="INFO",
    batch_size_per_gpu: int = None,
    gradient_accumulation_steps: int = None,
    global_batch_size: int = None,
    seq_len: int = None,
    total_num_tokens: int = None,
    activation_recomputation: int = 0,
    ds_zero: int = 0,
    dp_size: int = None,
    tp_size: int = 1,
    pp_size: int = 1,
    sp_size: int = None,
    ep_size: int = 1,
    total_num_gpus: int = None,
    layernorm_dtype_bytes: int = BYTES_FP32,
    master_weights_dtype_bytes: int = BYTES_FP32,
    other_op_bytes: int = None,
    flash_attn: bool = True,
    softmax_dropout: bool = False,
    mlp_activation_quant_bits: int = None,
    mlp_1linear_quant_bits: int = None,
    mlp_gelu_input_quant_bits: int = None,
    mlp_2linear_quant_bits: int = None,
    mlp_recompute_gelu: bool = False,
    mlp_gated_linear_units: bool = False,
    achieved_tflops: float = None,
    flops_efficiency: float = None,
    hbm_memory_efficiency: float = HBM_MEMORY_EFFICIENCY,
    intra_node_memory_efficiency=INTRA_NODE_MEMORY_EFFICIENCY,
    inter_node_memory_efficiency=INTER_NODE_MEMORY_EFFICIENCY,
    num_gpus_per_node: int = NUM_GPUS_PER_NODE,
    output_dir: str = None,
    output_file_suffix: str = "",
)

Source from the content-addressed store, hash-verified

2352
2353
2354def train(
2355 model_name="facebook_opt-1.3b",
2356 gpu_name="a100-sxm-40gb",
2357 dtype_name="w16a16e16",
2358 log_level="INFO",
2359 batch_size_per_gpu: int = None,
2360 gradient_accumulation_steps: int = None,
2361 global_batch_size: int = None,
2362 seq_len: int = None,
2363 total_num_tokens: int = None,
2364 activation_recomputation: int = 0,
2365 ds_zero: int = 0,
2366 dp_size: int = None,
2367 tp_size: int = 1,
2368 pp_size: int = 1,
2369 sp_size: int = None,
2370 ep_size: int = 1,
2371 total_num_gpus: int = None,
2372 layernorm_dtype_bytes: int = BYTES_FP32,
2373 master_weights_dtype_bytes: int = BYTES_FP32,
2374 other_op_bytes: int = None,
2375 flash_attn: bool = True,
2376 softmax_dropout: bool = False,
2377 mlp_activation_quant_bits: int = None,
2378 mlp_1linear_quant_bits: int = None,
2379 mlp_gelu_input_quant_bits: int = None,
2380 mlp_2linear_quant_bits: int = None,
2381 mlp_recompute_gelu: bool = False,
2382 mlp_gated_linear_units: bool = False,
2383 achieved_tflops: float = None,
2384 flops_efficiency: float = None,
2385 hbm_memory_efficiency: float = HBM_MEMORY_EFFICIENCY,
2386 intra_node_memory_efficiency=INTRA_NODE_MEMORY_EFFICIENCY,
2387 inter_node_memory_efficiency=INTER_NODE_MEMORY_EFFICIENCY,
2388 num_gpus_per_node: int = NUM_GPUS_PER_NODE,
2389 output_dir: str = None,
2390 output_file_suffix: str = "",
2391) -> dict:
2392 """Entry point function of training analysis for the command line interface. This
2393 uses pre-defined name-to-configuration mapping and common arguments to construct
2394 LLMAnalysis.
2395
2396 Args:
2397 model_name (str, optional): model name to query the pre-defined `model_configs` dict, or model config json file path, if not found, query Hugging Face to construct ModelConfig. Defaults to "facebook_opt-1.3b".
2398 gpu_name (str, optional): gpu name to query the pre-defined `gpu_configs` dict. Defaults to "a100-sxm-40gb".
2399 dtype_name (str, optional): data type name to pre-defined `dtype_configs` dict. Defaults to "w16a16e16".
2400 log_level (str, optional): logging level. Defaults to "INFO".
2401 batch_size_per_gpu (int, optional): batch size per GPU (micro batch size). Defaults to None.
2402 gradient_accumulation_steps (int, optional): gradient accumulation steps. Defaults to None.
2403 global_batch_size (int, optional): global batch size. Defaults to None.
2404 seq_len (int, optional): sequence length. Defaults to None.
2405 total_num_tokens (int, optional): total number of tokens used for training. Defaults to None.
2406 activation_recomputation (int, optional): activation recomputation strategy. See `ActivationRecomputation`. Defaults to 0.
2407 ds_zero (int, optional): which DeepSpeed ZeRO stage to use. See `DSZeRO`. Defaults to 0.
2408 dp_size (int, optional): data parallelism size. Defaults to None.
2409 tp_size (int, optional): tensor parallelism size. Defaults to 1.
2410 pp_size (int, optional): pipeline parallelism size. Defaults to 1.
2411 sp_size (int, optional): sequence parallelism size. Defaults to tp_size.

Callers

nothing calls this directly

Calls 8

trainingMethod · 0.95
get_model_config_by_nameFunction · 0.90
get_gpu_config_by_nameFunction · 0.90
get_dtype_config_by_nameFunction · 0.90
ParallelismConfigClass · 0.90
LLMAnalysisClass · 0.85
DSZeROClass · 0.85

Tested by

no test coverage detected