diff --git a/utils.py b/utils.py index a21302c..131b634 100644 --- a/utils.py +++ b/utils.py @@ -505,7 +505,11 @@ def compile_model(transformer, compile_args=None): if hasattr(torch, '_dynamo') and hasattr(torch._dynamo, 'config'): torch._dynamo.config.cache_size_limit = compile_args["dynamo_cache_size_limit"] torch._dynamo.config.force_parameter_static_shapes = compile_args["force_parameter_static_shapes"] - torch._dynamo.config.allow_unspec_int_on_nn_module = True + try: + if hasattr(torch._dynamo.config, 'allow_unspec_int_on_nn_module'): + torch._dynamo.config.allow_unspec_int_on_nn_module = compile_args["allow_unspec_int_on_nn_module"] + except Exception as e: + log.warning(f"Could not set allow_unspec_int_on_nn_module: {e}") try: torch._dynamo.config.recompile_limit = compile_args["dynamo_recompile_limit"] except Exception as e: