[CI] revert device in `test_export_static_cache`
Author: gante
Pull request: yes

# What does this PR do?

#38976 makes our torch export integration compatible with models on GPU.

However, there is possibly something wrong with it: small models cause GPU OOM in our related tests. This PR reverts the device while we [I need help from the export folks] are exploring the issue, to prevent other regressions.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_39662). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

OK, I confirm it works when using `cpu`, at least for `qwen3` and `phi3`

But for those 2 models, the error doesn't seem to be GPU OOM, but

```bash
E       torch._dynamo.exc.TorchRuntimeError: Dynamo failed to run FX node with fake tensors: call_method index_copy_(*(FakeTensor(..., size=(1, 8, 26, 128), dtype=torch.bfloat16), 2, FakeTensor(..., device='cuda:0', size=(1,), dtype=torch.int64), FakeTensor(..., device='cuda:0', size=(1, 8, 1, 128), dtype=torch.bfloat16,
E                  grad_fn=<AddBack
```
(But maybe related)



Full log

```
============================================================================== FAILURES ===============================================================================
____________________________________________________________ Qwen3IntegrationTest.test_export_static_cache ____________________________________________________________

self = <tests.models.qwen3.test_modeling_qwen3.Qwen3IntegrationTest testMethod=test_export_static_cache>

    @slow
    def test_export_static_cache(self):
        if version.parse(torch.__version__) < version.parse("2.4.0"):
            self.skipTest(reason="This test requires torch >= 2.4 to run.")

        from transformers.integrations.executorch import (
            TorchExportableModuleWithStaticCache,
        )

        qwen_model = "Qwen/Qwen3-0.6B-Base"

        tokenizer = AutoTokenizer.from_pretrained(qwen_model, pad_token="
", padding_side="right")
        if version.parse(torch.__version__) == version.parse("2.7.0"):
            strict = False  # Due to https://github.com/pytorch/pytorch/issues/150994
            cuda_expectation = ["My favourite condiment is 100% plain, unflavoured, and unadulterated."]
        else:
            strict = True
            cuda_expectation = ["My favourite condiment is 100% plain, unflavoured, and unadulterated. It is"]

        expected_text_completions = Expectations(
            {
                ("rocm", (9, 5)): ["My favourite condiment is 100% plain, unflavoured, and unadulterated."],
                ("cuda", None): cuda_expectation,
            }
        )  # fmt: skip
        EXPECTED_TEXT_COMPLETION = expected_text_completions.get_expectation()

        max_generation_length = tokenizer(EXPECTED_TEXT_COMPLETION, return_tensors="pt", padding=True)[
            "input_ids"
        ].shape[-1]
        device = torch_device
        dtype = torch.bfloat16
        cache_implementation = "static"
        attn_implementation = "sdpa"
        batch_size = 1

        # Load model
        model = Qwen3ForCausalLM.from_pretrained(
            qwen_model,
            device_map=device,
            torch_dtype=dtype,
            attn_implementation=attn_implementation,
            generation_config=GenerationConfig(
                use_cache=True,
                cache_implementation=cache_implementation,
                max_length=max_generation_length,
                cache_config={
                    "batch_size": batch_size,
                    "max_cache_len": max_generation_length,
                },
            ),
        )

        prompt = ["My favourite condiment is "]
        prompt_tokens = tokenizer(prompt, return_tensors="pt", padding=True).to(model.device)
        prompt_token_ids = prompt_tokens["input_ids"]
        max_new_tokens = max_generation_length - prompt_token_ids.shape[-1]

        # Static Cache + export
        from transformers.integrations.executorch import TorchExportableModuleForDecoderOnlyLM

        exportable_module = TorchExportableModuleForDecoderOnlyLM(model)
>       exported_program = exportable_module.export(strict=strict)

tests/models/qwen3/test_modeling_qwen3.py:296:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/transformers/integrations/executorch.py:128: in export
    exported_program = torch.export.export(
/usr/local/lib/python3.10/dist-packages/torch/export/__init__.py:360: in export
    return _export(
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1100: in wrapper
    raise e
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1066: in wrapper
    ep = fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/export/exported_program.py:121: in wrapper
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:2120: in _export
    ep = _export_for_training(
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1100: in wrapper
    raise e
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1066: in wrapper
    ep = fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/export/exported_program.py:121: in wrapper
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1983: in _export_for_training
    export_artifact = export_func(  # type: ignore[operator]
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:1352: in _strict_export_lower_to_aten_ir
    gm_torch_level = _export_to_torch_ir(
/usr/local/lib/python3.10/dist-packages/torch/export/_trace.py:740: in _export_to_torch_ir
    gm_torch_level, _ = torch._dynamo.export(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/eval_frame.py:1677: in inner
    result_traced = opt_f(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1751: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1762: in _call_impl
    return forward_call(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/eval_frame.py:655: in _fn
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1751: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1762: in _call_impl
    return forward_call(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:1432: in __call__
    return self._torchdynamo_orig_callable(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:598: in __call__
    return _compile(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:1059: in _compile
    guarded_code = compile_inner(code, one_graph, hooks, transform)
/usr/local/lib/python3.10/dist-packages/torch/_utils_internal.py:97: in wrapper_function
    return function(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:761: in compile_inner
    return _compile_inner(code, one_graph, hooks, transform)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:797: in _compile_inner
    out_code = transform_code_object(code, transform)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/bytecode_transformation.py:1422: in transform_code_object
    transformations(instructions, code_options)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:257: in _fn
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/convert_frame.py:715: in transform
    tracer.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3498: in run
    super().run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2276: in CALL_FUNCTION_KW
    self.call_function(fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/nn_module.py:481: in call_function
    return tx.inline_user_function_return(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:936: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/nn_module.py:481: in call_function
    return tx.inline_user_function_return(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:936: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/nn_module.py:481: in call_function
    return tx.inline_user_function_return(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:936: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/nn_module.py:481: in call_function
    return tx.inline_user_function_return(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2264: in CALL_FUNCTION_EX
    self.call_function(fn, argsvars.items, kwargsvars)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:936: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2166: in CALL_FUNCTION
    self.call_function(fn, args, {})
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:936: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2166: in CALL_FUNCTION
    self.call_function(fn, args, {})
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:414: in call_function
    return super().call_function(tx, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/functions.py:184: in call_function
    return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1187: in inline_user_function_return
    return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3724: in inline_call
    return tracer.inline_call_()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:3903: in inline_call_
    self.run()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1337: in run
    while self.step():
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1246: in step
    self.dispatch_table[inst.opcode](self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:819: in wrapper
    return inner_fn(self, inst)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:2166: in CALL_FUNCTION
    self.call_function(fn, args, {})
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/symbolic_convert.py:1170: in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/misc.py:913: in call_function
    return self.obj.call_method(tx, self.name, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/tensor.py:632: in call_method
    return wrap_fx_proxy(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/builder.py:2302: in wrap_fx_proxy
    return wrap_fx_proxy_cls(target_cls=TensorVariable, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/builder.py:2368: in wrap_fx_proxy_cls
    return _wrap_fx_proxy(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/variables/builder.py:2464: in _wrap_fx_proxy
    example_value = get_fake_value(proxy.node, tx, allow_non_graph_fake=True)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:3229: in get_fake_value
    raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:3127: in get_fake_value
    ret_val = wrap_fake_exception(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:2641: in wrap_fake_exception
    return fn()
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:3128: in <lambda>
    lambda: run_node(tx.output, node, args, kwargs, nnmodule)
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:3325: in run_node
    raise RuntimeError(make_error_message(e)).with_traceback(
/usr/local/lib/python3.10/dist-packages/torch/_dynamo/utils.py:3295: in run_node
    return getattr(args[0], node.target)(*args[1:], **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/utils/_stats.py:27: in wrapper
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1282: in __torch_dispatch__
    return self.dispatch(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1823: in dispatch
    return self._cached_dispatch_impl(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1384: in _cached_dispatch_impl
    output = self._dispatch_impl(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:2333: in _dispatch_impl
    decomposition_table[func](*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_decomp/decompositions.py:2738: in index_copy_
    return _index_copy(x, dim, index, tensor, inplace=True)
/usr/local/lib/python3.10/dist-packages/torch/_decomp/decompositions.py:2761: in _index_copy
    out = index_put(x1, idx, tensor)
/usr/local/lib/python3.10/dist-packages/torch/_ops.py:1158: in __call__
    return self._op(*args, **(kwargs or {}))
/usr/local/lib/python3.10/dist-packages/torch/utils/_stats.py:27: in wrapper
    return fn(*args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1282: in __torch_dispatch__
    return self.dispatch(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1823: in dispatch
    return self._cached_dispatch_impl(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:1384: in _cached_dispatch_impl
    output = self._dispatch_impl(func, types, args, kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_tensor.py:2397: in _dispatch_impl
    op_impl_out = op_impl(self, func, *args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_impls.py:160: in dispatch_to_op_implementations_dict
    return op_implementations_dict[func](fake_mode, func, *args, **kwargs)
/usr/local/lib/python3.10/dist-packages/torch/_subclasses/fake_impls.py:698: in index_put_impl
    torch._check(
/usr/local/lib/python3.10/dist-packages/torch/__init__.py:1660: in _check
    _check_with(RuntimeError, cond, message)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

error_type = <class 'RuntimeError'>, cond = False, message = <function index_put_impl.<locals>.<lambda> at 0x7f7525d25900>

    def _check_with(
        error_type,
        cond: _Union[builtins.bool, SymBool],
        message: _Callable[[], str],
    ):  # noqa: F811
        if not isinstance(cond, (builtins.bool, SymBool)):
            raise TypeError(f"cond must be a bool, but got {type(cond)}")

        from torch.fx.experimental.symbolic_shapes import expect_true

        if expect_true(cond):
            return

        # error_type must be a subclass of Exception and not subclass of Warning
        assert issubclass(error_type, Exception) and not issubclass(error_type, Warning)

        if message is None:
            message_evaluated = (
                "Expected cond to be True, but got False. (Could this error "
                "message be improved? If so, please report an enhancement request "
                "to PyTorch.)"
            )

        else:
            if not callable(message):
                raise TypeError("message must be a callable")

            message_evaluated = str(message())

>       raise error_type(message_evaluated)
E       torch._dynamo.exc.TorchRuntimeError: Dynamo failed to run FX node with fake tensors: call_method index_copy_(*(FakeTensor(..., size=(1, 8, 26, 128), dtype=torch.bfloat16), 2, FakeTensor(..., device='cuda:0', size=(1,), dtype=torch.int64), FakeTensor(..., device='cuda:0', size=(1, 8, 1, 128), dtype=torch.bfloat16,
E                  grad_fn=<AddBackward0>)), **{}): got RuntimeError('Mismatching aten.index_put_.default device between self (cpu) and values (cuda:0)')
E       
E       from user code:
E          File "/transformers/src/transformers/integrations/executorch.py", line 327, in forward
E           outs = self.model(
E         File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1762, in _call_impl
E           return forward_call(*args, **kwargs)
E         File "/transformers/src/transformers/utils/generic.py", line 961, in wrapper
E           output = func(self, *args, **kwargs)
E         File "/transformers/src/transformers/models/qwen3/modeling_qwen3.py", line 516, in forward
E           outputs: BaseModelOutputWithPast = self.model(
E         File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1762, in _call_impl
E           return forward_call(*args, **kwargs)
E         File "/transformers/src/transformers/utils/generic.py", line 1067, in wrapper
E           outputs = func(self, *args, **kwargs)
E         File "/transformers/src/transformers/models/qwen3/modeling_qwen3.py", line 428, in forward
E           hidden_states = decoder_layer(
E         File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1762, in _call_impl
E           return forward_call(*args, **kwargs)
E         File "/transformers/src/transformers/models/qwen3/modeling_qwen3.py", line 261, in forward
E           hidden_states, _ = self.self_attn(
E         File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1762, in _call_impl
E           return forward_call(*args, **kwargs)
E         File "/transformers/src/transformers/models/qwen3/modeling_qwen3.py", line 212, in forward
E           key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
E         File "/transformers/src/transformers/cache_utils.py", line 1190, in update
E           return _static_cache_update(
E         File "/transformers/src/transformers/cache_utils.py", line 54, in _static_cache_update
E           k_cache.index_copy_(2, cache_position, key_states)
E       
E       Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"

/usr/local/lib/python3.10/dist-packages/torch/__init__.py:1642: TorchRuntimeError

```

**[For maintainers]** Suggested jobs to run (before merge)

run-slow: cohere2, gemma, gemma2, llama, olmo, olmo2, phi3, qwen2, qwen3, smollm3