Что за ошибка {
"name": "InternalTorchDynamoError",
"message": "module 'torch.compiler' has no attribute 'is_compiling'
from user code:
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 1695, in forward
outputs = self.bert(
File "/home/ubuntu/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 1056, in forward
self.warn_if_padding_and_no_attention_mask(input_ids, attention_mask)
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4682, in warn_if_padding_and_no_attention_mask
if is_torch_fx_proxy(input_ids) or torch.jit.is_tracing() or is_torchdynamo_compiling():
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 694, in is_torchdynamo_compiling
return torch.compiler.is_compiling()
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
You can suppress this exception and fall back to eager by setting:
import torch._dynamo
torch._dynamo.config.suppress_errors = True
",
"stack": "---------------------------------------------------------------------------
InternalTorchDynamoError Traceback (most recent call last)
Cell In[15], line 1
----> 1 trainer.train()
File ~/.local/lib/python3.10/site-packages/transformers/trainer.py:1938, in Trainer.train(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)
1936 hf_hub_utils.enable_progress_bars()
1937 else:
-> 1938 return inner_training_loop(
1939 args=args,
1940 resume_from_checkpoint=resume_from_checkpoint,
1941 trial=trial,
1942 ignore_keys_for_eval=ignore_keys_for_eval,
1943 )
File ~/.local/lib/python3.10/site-packages/transformers/trainer.py:2279, in Trainer._inner_training_loop(self, batch_size, args, resume_from_checkpoint, trial, ignore_keys_for_eval)
2276 self.control = self.callback_handler.on_step_begin(args, self.state, self.control)
2278 with self.accelerator.accumulate(model):
-> 2279 tr_loss_step = self.training_step(model, inputs)
2281 if (
2282 args.logging_nan_inf_filter
2283 and not is_torch_xla_available()
2284 and (torch.isnan(tr_loss_step) or torch.isinf(tr_loss_step))
2285 ):
2286 # if loss is nan or inf simply add the average of previous logged losses
2287 tr_loss += tr_loss / (1 + self.state.global_step - self._globalstep_last_logged)
File ~/.local/lib/python3.10/site-packages/transformers/trainer.py:3318, in Trainer.training_step(self, model, inputs)
3315 return loss_mb.reduce_mean().detach().to(self.args.device)
3317 with self.compute_loss_context_manager():
-> 3318 loss = self.compute_loss(model, inputs)
3320 del inputs
3321 if (
3322 self.args.torch_empty_cache_steps is not None
3323 and self.state.global_step % self.args.torch_empty_cache_steps == 0
3324 ):
File ~/.local/lib/python3.10/site-packages/transformers/trainer.py:3363, in Trainer.compute_loss(self, model, inputs, return_outputs)
3361 else:
3362 labels = None
-> 3363 outputs = model(**inputs)
3364 # Save past state if it exists
3365 # TODO: this needs to be fixed and made cleaner later.
3366 if self.args.past_index >= 0:
File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
-> 1518 return self._call_impl(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1527, in Module._call_impl(self, *args, **kwargs)
1522 # If we don't have any hooks, we want to skip the rest of the logic in
1523 # this function, and just call forward.
1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1529 try:
1530 result = None
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py:328, in _TorchDynamoContext.call.._fn(*args, **kwargs)
326 dynamic_ctx.enter()
327 try:
--> 328 return fn(*args, **kwargs)
329 finally:
330 set_eval_frame(prior)
File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
-> 1518 return self._call_impl(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1527, in Module._call_impl(self, *args, **kwargs)
1522 # If we don't have any hooks, we want to skip the rest of the logic in
1523 # this function, and just call forward.
1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1529 try:
1530 result = None
File ~/.local/lib/python3.10/site-packages/accelerate/utils/operations.py:822, in convert_outputs_to_fp32..forward(*args, **kwargs)
821 def forward(*args, **kwargs):
--> 822 return model_forward(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/accelerate/utils/operations.py:810, in ConvertOutputsToFp32.call(self, *args, **kwargs)
809 def call(self, *args, **kwargs):
--> 810 return convert_to_fp32(self.model_forward(*args, **kwargs))
File ~/.local/lib/python3.10/site-packages/torch/amp/autocast_mode.py:16, in autocast_decorator..decorate_autocast(*args, **kwargs)
13 @functools.wraps(func)
14 def decorate_autocast(*args, **kwargs):
15 with autocast_instance:
---> 16 return func(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/accelerate/utils/operations.py:822, in convert_outputs_to_fp32..forward(*args, **kwargs)
821 def forward(*args, **kwargs):
--> 822 return model_forward(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/accelerate/utils/operations.py:810, in ConvertOutputsToFp32.call(self, *args, **kwargs)
809 def call(self, *args, **kwargs):
--> 810 return convert_to_fp32(self.model_forward(*args, **kwargs))
File ~/.local/lib/python3.10/site-packages/torch/amp/autocast_mode.py:16, in autocast_decorator..decorate_autocast(*args, **kwargs)
13 @functools.wraps(func)
14 def decorate_autocast(*args, **kwargs):
15 with autocast_instance:
---> 16 return func(*args, **kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py:490, in catch_errors_wrapper..catch_errors(frame, cache_entry, frame_state)
487 return hijacked_callback(frame, cache_entry, hooks, frame_state)
489 with compile_lock, _disable_current_modes():
--> 490 return callback(frame, cache_entry, hooks, frame_state)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:641, in convert_frame.._convert_frame(frame, cache_size, hooks, frame_state)
639 counters["frames"]["total"] += 1
640 try:
--> 641 result = inner_convert(frame, cache_size, hooks, frame_state)
642 counters["frames"]["ok"] += 1
643 return result
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:133, in wrap_convert_context.._fn(*args, **kwargs)
131 cleanup = setup_compile_debug()
132 try:
--> 133 return fn(*args, **kwargs)
134 finally:
135 cleanup.close()
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:389, in convert_frame_assert.._convert_frame_assert(frame, cache_entry, hooks, frame_state)
376 compile_id = CompileId(frame_id, frame_compile_id)
378 signpost_event(
379 "dynamo",
380 "_convert_frame_assert._compile",
(...)
386 },
387 )
--> 389 return _compile(
390 frame.f_code,
391 frame.f_globals,
392 frame.f_locals,
393 frame.f_builtins,
394 compiler_fn,
395 one_graph,
396 export,
397 export_constraints,
398 hooks,
399 cache_size,
400 frame,
401 frame_state=frame_state,
402 compile_id=compile_id,
403 )
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:586, in _compile(code, globals, locals, builtins, compiler_fn, one_graph, export, export_constraints, hooks, cache_size, frame, frame_state, compile_id)
584 fail_reason = str(e)
585 exception_handler(e, code, frame, export=export)
--> 586 raise InternalTorchDynamoError(str(e)).with_traceback(
587 e.traceback
588 ) from None
589 finally:
590 from .utils import curr_frame
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:569, in _compile(code, globals, locals, builtins, compiler_fn, one_graph, export, export_constraints, hooks, cache_size, frame, frame_state, compile_id)
567 with compile_context(CompileContext(compile_id)):
568 try:
--> 569 guarded_code = compile_inner(code, one_graph, hooks, transform)
570 return guarded_code
571 except (
572 Unsupported,
573 TorchRuntimeError,
(...)
578 ValidationException,
579 ) as e:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/utils.py:189, in dynamo_timed..dynamo_timed_inner..time_wrapper(*args, **kwargs)
187 with torch.profiler.record_function(f"{key} (dynamo_timed)"):
188 t0 = time.time()
--> 189 r = func(*args, **kwargs)
190 time_spent = time.time() - t0
191 compilation_time_metrics[key].append(time_spent)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:491, in _compile..compile_inner(code, one_graph, hooks, transform)
489 for attempt in itertools.count():
490 try:
--> 491 out_code = transform_code_object(code, transform)
492 orig_code_map[out_code] = code
493 break
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py:1028, in transform_code_object(code, transformations, safe)
1025 instructions = cleaned_instructions(code, safe)
1026 propagate_line_nums(instructions)
-> 1028 transformations(instructions, code_options)
1029 return clean_and_assemble_instructions(instructions, keys, code_options)[1]
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:458, in _compile..transform(instructions, code_options)
456 try:
457 with tracing(tracer.output.tracing_context):
--> 458 tracer.run()
459 except (exc.RestartAnalysis, exc.SkipFrame):
460 raise
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2069, in InstructionTranslator.run(self)
2068 def run(self):
-> 2069 super().run()
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:719, in InstructionTranslatorBase.run(self)
714 try:
715 self.output.push_tx(self)
716 while (
717 self.instruction_pointer is not None
718 and not self.output.should_exit
--> 719 and self.step()
720 ):
721 pass
722 except BackendCompilerFailed:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:683, in InstructionTranslatorBase.step(self)
679 unimplemented(f"missing: {inst.opname}")
680 TracingContext.set_current_loc(
681 self.f_code.co_filename, self.lineno, self.f_code.co_name
682 )
--> 683 getattr(self, inst.opname)(inst)
685 return inst.opname != "RETURN_VALUE"
686 except Unsupported:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:392, in break_graph_if_unsupported..decorator..wrapper(self, inst)
388 try:
389 TracingContext.set_current_loc(
390 self.f_code.co_filename, self.lineno, self.f_code.co_name
391 )
--> 392 return inner_fn(self, inst)
393 except Unsupported as excp:
394 if self.has_backedge() and self.should_compile_partial_graph():
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1162, in InstructionTranslatorBase.CALL_FUNCTION_KW(self, inst)
1160 kwargs = dict(zip(argnames, kwargs_list))
1161 assert len(kwargs) == len(argnames)
-> 1162 self.call_function(fn, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:557, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
555 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
556 raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 557 self.push(fn.call_function(self, args, kwargs))
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py:331, in NNModuleVariable.call_function(self, tx, args, kwargs)
329 assert istype(fn, types.FunctionType)
330 options["source"] = fn_source
--> 331 return tx.inline_user_function_return(
332 variables.UserFunctionVariable(fn, **options),
333 args,
334 kwargs,
335 )
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:593, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
591 state = self.copy_graphstate()
592 try:
--> 593 result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
594 self.output.guards.update(fn.guards)
595 return result
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2174, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
2171 @classmethod
2172 def inline_call(cls, parent, func, args, kwargs):
2173 with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2174 return cls.inline_call(parent, func, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2281, in InliningInstructionTranslator.inline_call(parent, func, args, kwargs)
2279 try:
2280 with strict_ctx:
-> 2281 tracer.run()
2282 except exc.SkipFrame as e:
2283 msg = f"SKIPPED INLINING {code}: {e}"
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:719, in InstructionTranslatorBase.run(self)
714 try:
715 self.output.push_tx(self)
716 while (
717 self.instruction_pointer is not None
718 and not self.output.should_exit
--> 719 and self.step()
720 ):
721 pass
722 except BackendCompilerFailed:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:683, in InstructionTranslatorBase.step(self)
679 unimplemented(f"missing: {inst.opname}")
680 TracingContext.set_current_loc(
681 self.f_code.co_filename, self.lineno, self.f_code.co_name
682 )
--> 683 getattr(self, inst.opname)(inst)
685 return inst.opname != "RETURN_VALUE"
686 except Unsupported:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:392, in break_graph_if_unsupported..decorator..wrapper(self, inst)
388 try:
389 TracingContext.set_current_loc(
390 self.f_code.co_filename, self.lineno, self.f_code.co_name
391 )
--> 392 return inner_fn(self, inst)
393 except Unsupported as excp:
394 if self.has_backedge() and self.should_compile_partial_graph():
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1150, in InstructionTranslatorBase.CALL_FUNCTION_EX(self, inst)
1145 if not isinstance(argsvars, BaseListVariable) or not isinstance(
1146 kwargsvars, ConstDictVariable
1147 ):
1148 unimplemented(f"non-static call {typestr(argsvars)} {typestr(kwargsvars)}")
-> 1150 self.call_function(fn, argsvars.items, kwargsvars.items)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:557, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
555 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
556 raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 557 self.push(fn.call_function(self, args, kwargs))
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:307, in UserMethodVariable.call_function(self, tx, args, kwargs)
299 if (
300 module_attr is not None
301 and module_attr.startswith("torch.nn.")
302 or self.is_constant
303 ):
304 return self.obj.call_method(
305 tx, self.fn.name, args, kwargs, constant=self.is_constant
306 ).add_options(self)
--> 307 return super().call_function(tx, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:261, in UserFunctionVariable.call_function(self, tx, args, kwargs)
256 options = VariableTracker.propagate(self, args, kwargs.values())
257 return invoke_and_store_as_constant(
258 tx, self.fn, self.get_name(), options, args, kwargs
259 )
--> 261 return super().call_function(tx, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:90, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
87 def call_function(
88 self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
89 ) -> "VariableTracker":
---> 90 return tx.inline_user_function_return(
91 self, list(self.self_args()) + list(args), kwargs
92 )
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:593, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
591 state = self.copy_graphstate()
592 try:
--> 593 result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
594 self.output.guards.update(fn.guards)
595 return result
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2174, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
2171 @classmethod
2172 def inline_call(cls, parent, func, args, kwargs):
2173 with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2174 return cls.inline_call(parent, func, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2281, in InliningInstructionTranslator.inline_call(parent, func, args, kwargs)
2279 try:
2280 with strict_ctx:
-> 2281 tracer.run()
2282 except exc.SkipFrame as e:
2283 msg = f"SKIPPED INLINING {code}: {e}"
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:719, in InstructionTranslatorBase.run(self)
714 try:
715 self.output.push_tx(self)
716 while (
717 self.instruction_pointer is not None
718 and not self.output.should_exit
--> 719 and self.step()
720 ):
721 pass
722 except BackendCompilerFailed:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:683, in InstructionTranslatorBase.step(self)
679 unimplemented(f"missing: {inst.opname}")
680 TracingContext.set_current_loc(
681 self.f_code.co_filename, self.lineno, self.f_code.co_name
682 )
--> 683 getattr(self, inst.opname)(inst)
685 return inst.opname != "RETURN_VALUE"
686 except Unsupported:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:392, in break_graph_if_unsupported..decorator..wrapper(self, inst)
388 try:
389 TracingContext.set_current_loc(
390 self.f_code.co_filename, self.lineno, self.f_code.co_name
391 )
--> 392 return inner_fn(self, inst)
393 except Unsupported as excp:
394 if self.has_backedge() and self.should_compile_partial_graph():
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1110, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
1108 args = self.popn(inst.argval)
1109 fn = self.pop()
-> 1110 self.call_function(fn, args, {})
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:557, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
555 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
556 raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 557 self.push(fn.call_function(self, args, kwargs))
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:307, in UserMethodVariable.call_function(self, tx, args, kwargs)
299 if (
300 module_attr is not None
301 and module_attr.startswith("torch.nn.")
302 or self.is_constant
303 ):
304 return self.obj.call_method(
305 tx, self.fn.name, args, kwargs, constant=self.is_constant
306 ).add_options(self)
--> 307 return super().call_function(tx, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:261, in UserFunctionVariable.call_function(self, tx, args, kwargs)
256 options = VariableTracker.propagate(self, args, kwargs.values())
257 return invoke_and_store_as_constant(
258 tx, self.fn, self.get_name(), options, args, kwargs
259 )
--> 261 return super().call_function(tx, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:90, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
87 def call_function(
88 self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
89 ) -> "VariableTracker":
---> 90 return tx.inline_user_function_return(
91 self, list(self.self_args()) + list(args), kwargs
92 )
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:593, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
591 state = self.copy_graphstate()
592 try:
--> 593 result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
594 self.output.guards.update(fn.guards)
595 return result
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2174, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
2171 @classmethod
2172 def inline_call(cls, parent, func, args, kwargs):
2173 with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2174 return cls.inline_call(parent, func, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2281, in InliningInstructionTranslator.inline_call(parent, func, args, kwargs)
2279 try:
2280 with strict_ctx:
-> 2281 tracer.run()
2282 except exc.SkipFrame as e:
2283 msg = f"SKIPPED INLINING {code}: {e}"
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:719, in InstructionTranslatorBase.run(self)
714 try:
715 self.output.push_tx(self)
716 while (
717 self.instruction_pointer is not None
718 and not self.output.should_exit
--> 719 and self.step()
720 ):
721 pass
722 except BackendCompilerFailed:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:683, in InstructionTranslatorBase.step(self)
679 unimplemented(f"missing: {inst.opname}")
680 TracingContext.set_current_loc(
681 self.f_code.co_filename, self.lineno, self.f_code.co_name
682 )
--> 683 getattr(self, inst.opname)(inst)
685 return inst.opname != "RETURN_VALUE"
686 except Unsupported:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:392, in break_graph_if_unsupported..decorator..wrapper(self, inst)
388 try:
389 TracingContext.set_current_loc(
390 self.f_code.co_filename, self.lineno, self.f_code.co_name
391 )
--> 392 return inner_fn(self, inst)
393 except Unsupported as excp:
394 if self.has_backedge() and self.should_compile_partial_graph():
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1110, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
1108 args = self.popn(inst.argval)
1109 fn = self.pop()
-> 1110 self.call_function(fn, args, {})
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:557, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
555 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
556 raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 557 self.push(fn.call_function(self, args, kwargs))
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:261, in UserFunctionVariable.call_function(self, tx, args, kwargs)
256 options = VariableTracker.propagate(self, args, kwargs.values())
257 return invoke_and_store_as_constant(
258 tx, self.fn, self.get_name(), options, args, kwargs
259 )
--> 261 return super().call_function(tx, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:90, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
87 def call_function(
88 self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
89 ) -> "VariableTracker":
---> 90 return tx.inline_user_function_return(
91 self, list(self.self_args()) + list(args), kwargs
92 )
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:593, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
591 state = self.copy_graphstate()
592 try:
--> 593 result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
594 self.output.guards.update(fn.guards)
595 return result
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2174, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
2171 @classmethod
2172 def inline_call(cls, parent, func, args, kwargs):
2173 with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2174 return cls.inline_call(parent, func, args, kwargs)
File ~/.local/lib/python3.10/site-packages/torch/dynamo/symbolic_convert.py:2281, in InliningInstructionTranslator.inline_call(parent, func, args, kwargs)
2279 try:
2280 with strict_ctx:
-> 2281 tracer.run()
2282 except exc.SkipFrame as e:
2283 msg = f"SKIPPED INLINING {code}: {e}"
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:719, in InstructionTranslatorBase.run(self)
714 try:
715 self.output.push_tx(self)
716 while (
717 self.instruction_pointer is not None
718 and not self.output.should_exit
--> 719 and self.step()
720 ):
721 pass
722 except BackendCompilerFailed:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:683, in InstructionTranslatorBase.step(self)
679 unimplemented(f"missing: {inst.opname}")
680 TracingContext.set_current_loc(
681 self.f_code.co_filename, self.lineno, self.f_code.co_name
682 )
--> 683 getattr(self, inst.opname)(inst)
685 return inst.opname != "RETURN_VALUE"
686 except Unsupported:
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1186, in InstructionTranslatorBase.LOAD_ATTR(self, inst)
1184 def LOAD_ATTR(self, inst):
1185 obj = self.pop()
-> 1186 result = BuiltinVariable(getattr).call_function(
1187 self, [obj, ConstantVariable(inst.argval)], {}
1188 )
1189 self.push(result)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/builtin.py:618, in BuiltinVariable.call_function(self, tx, args, kwargs)
616 if handler:
617 try:
--> 618 result = handler(tx, *args, **kwargs)
619 if result is not None:
620 return result.add_options(options)
File ~/.local/lib/python3.10/site-packages/torch/_dynamo/variables/builtin.py:1121, in BuiltinVariable.call_getattr(self, tx, obj, name_var, default)
1119 return GetAttrVariable(obj, name, **options)
1120 elif isinstance(obj, TorchVariable):
-> 1121 member = getattr(obj.value, name)
1122 if is_utils_checkpoint(member):
1123 options["source"] = source
InternalTorchDynamoError: module 'torch.compiler' has no attribute 'is_compiling'
from user code:
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 1695, in forward
outputs = self.bert(
File "/home/ubuntu/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 1056, in forward
self.warn_if_padding_and_no_attention_mask(input_ids, attention_mask)
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4682, in warn_if_padding_and_no_attention_mask
if is_torch_fx_proxy(input_ids) or torch.jit.is_tracing() or is_torchdynamo_compiling():
File "/home/ubuntu/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 694, in is_torchdynamo_compiling
return torch.compiler.is_compiling()
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
You can suppress this exception and fall back to eager by setting:
import torch._dynamo
torch._dynamo.config.suppress_errors = True
"
}