<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>tema Re: Unable to use HETERO Plugin with manual affinity en Intel® Distribution of OpenVINO™ Toolkit</title>
    <link>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746776#M32454</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi GlowingScrewdriver,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is the method for pinning an operation to a device using a model ID.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from optimum.intel.openvino import OVModelForCausalLM
import openvino
from transformers import AutoTokenizer

model_id="OpenVINO/qwen3-8b-int4-ov" 
DEVICE = "HETERO:GPU,CPU"

def set_affinities(model, target_ops): 
  core = openvino.Core()
  ov_model = model.model # Get the underlying OpenVINO model   
  # Query what operations are supported on each device
  supported_ops = core.query_model(ov_model, DEVICE)
  for node in ov_model.get_ops():
    fname = node.get_friendly_name()
    # Force specific operations to CPU
    if fname in target_ops:
      print(f"Pinning to CPU: {node}")
      node.get_rt_info()["affinity"] = "CPU"
    else:
      affinity = supported_ops[fname]
      node.get_rt_info()["affinity"] = affinity
      #print(f"Assigning to GPU: {node}")

# Define operations you want to force to CPU
target_ops = {
  # Example operation names
  "Constant_100568",
  "Constant_100569"
}

model = OVModelForCausalLM.from_pretrained(model_id)
set_affinities(model, target_ops)
model.to (DEVICE)
model.compile()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Peh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2026 04:45:01 GMT</pubDate>
    <dc:creator>Peh_Intel</dc:creator>
    <dc:date>2026-05-05T04:45:01Z</dc:date>
    <item>
      <title>Unable to use HETERO Plugin with manual affinity</title>
      <link>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746671#M32453</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to run a model on OpenVINO HETERO plugin, while manually assigning node affinities to force some layers to execute on the CPU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The model in question is a transformer model from HuggingFace (Qwen3-8B). I have tried using the converted model from at&amp;nbsp;&lt;A href="https://huggingface.co/OpenVINO/Qwen3-8B-int4-ov" target="_blank" rel="noopener"&gt;OpenVINO/Qwen3-8B-int4-ov&lt;/A&gt;, as well as exporting the model using `optimum-cli`, but the issue persists with both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is adapted from this section in the official documentation on &lt;A href="https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/hetero-execution.html#using-manual-and-automatic-modes-in-combination" target="_blank" rel="noopener"&gt;"Using Manual and Automatic Modes in Combination"&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;DEVICE = "HETERO:GPU,CPU"
MODEL = "./Qwen3-8B-ov"

def set_affinities (model):
    supported_ops = core.query_model (model, DEVICE)
    for node in model.get_ops ():
        fname = node.get_friendly_name ()
        # target_ops is a set of node names that should be on the CPU
        if fname in target_ops:
            print (f"Pinning to CPU: {node}")
            affinity = "CPU"
        else:
            affinity = supported_ops [fname]
        node.get_rt_info ()["affinity"] = affinity

model = OVModelForCausalLM.from_pretrained (MODEL)
set_affinities (MODEL)
model.to (DEVICE)
model.compile ()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At runtime, I get this error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
  File "/home/vedanth/Desktop/ov-inference.py", line 42, in &amp;lt;module&amp;gt;
    model.compile ()
  File "/home/vedanth/Desktop/models/venv/lib/python3.12/site-packages/optimum/intel/openvino/modeling_decoder.py", line 428, in compile
    super().compile()
  File "/home/vedanth/Desktop/models/venv/lib/python3.12/site-packages/optimum/intel/openvino/modeling_base.py", line 922, in compile
    self.request = self._compile_model(self.model, self._device, ov_config, self.model_save_dir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedanth/Desktop/models/venv/lib/python3.12/site-packages/optimum/intel/openvino/modeling_base.py", line 418, in _compile_model
    compiled_model = core.compile_model(model, device.upper() if device is not None else device, config=ov_config)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedanth/Desktop/models/venv/lib/python3.12/site-packages/openvino/_ov_api.py", line 646, in compile_model
    super().compile_model(model, device_name, {} if config is None else config),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Exception from src/inference/src/cpp/core.cpp:110:
Exception from src/inference/src/dev/plugin.cpp:53:
Check 'unregistered_parameters.str().empty()' failed at src/core/src/model.cpp:58:
Model references undeclared parameters: opset1::Parameter input_ids () -&amp;gt; (i64[?,?])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure where to start debugging the issue. Any leads will be appreciated. Alternatively, if there is a better way of pinning an operation to a device, I would be happy to try it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OpenVINO version: 2026.0.0&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2026 11:47:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746671#M32453</guid>
      <dc:creator>GlowingScrewdriver</dc:creator>
      <dc:date>2026-05-04T11:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use HETERO Plugin with manual affinity</title>
      <link>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746776#M32454</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi GlowingScrewdriver,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is the method for pinning an operation to a device using a model ID.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from optimum.intel.openvino import OVModelForCausalLM
import openvino
from transformers import AutoTokenizer

model_id="OpenVINO/qwen3-8b-int4-ov" 
DEVICE = "HETERO:GPU,CPU"

def set_affinities(model, target_ops): 
  core = openvino.Core()
  ov_model = model.model # Get the underlying OpenVINO model   
  # Query what operations are supported on each device
  supported_ops = core.query_model(ov_model, DEVICE)
  for node in ov_model.get_ops():
    fname = node.get_friendly_name()
    # Force specific operations to CPU
    if fname in target_ops:
      print(f"Pinning to CPU: {node}")
      node.get_rt_info()["affinity"] = "CPU"
    else:
      affinity = supported_ops[fname]
      node.get_rt_info()["affinity"] = affinity
      #print(f"Assigning to GPU: {node}")

# Define operations you want to force to CPU
target_ops = {
  # Example operation names
  "Constant_100568",
  "Constant_100569"
}

model = OVModelForCausalLM.from_pretrained(model_id)
set_affinities(model, target_ops)
model.to (DEVICE)
model.compile()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Peh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 04:45:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746776#M32454</guid>
      <dc:creator>Peh_Intel</dc:creator>
      <dc:date>2026-05-05T04:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use HETERO Plugin with manual affinity</title>
      <link>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746779#M32455</link>
      <description>&lt;P&gt;Hello Peh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your quick response. Apologies for the typos in my code, which seem to have crept in since I adapted the snippet from a larger piece of code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you suggested is indeed what I had tried, i.e. getting default affinities using `core.query_model()`, selecting nodes using their names, and overriding affinities per-node by assigning to `node.get_rt_info()["affinity"]`.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is this: when I pin some nodes to the CPU and try to compile the model, I run into an error about undeclared parameters in the model. The issue does not arise if I do `node.get_rt_info ["affinity"] = "GPU"` or&amp;nbsp;`node.get_rt_info ["affinity"] = "CPU"` for all nodes; it only occurs when I selectively assign some nodes to CPU and the rest to GPU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Vedanth&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 05:22:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746779#M32455</guid>
      <dc:creator>GlowingScrewdriver</dc:creator>
      <dc:date>2026-05-05T05:22:22Z</dc:date>
    </item>
    <item>
      <title>Re:Unable to use HETERO Plugin with manual affinity</title>
      <link>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746916#M32457</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;Hi Vedanth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;Could you please provide your complete code for further investigation on this selective node affinity assignment?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;Peh&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2026 03:05:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Unable-to-use-HETERO-Plugin-with-manual-affinity/m-p/1746916#M32457</guid>
      <dc:creator>Peh_Intel</dc:creator>
      <dc:date>2026-05-06T03:05:23Z</dc:date>
    </item>
  </channel>
</rss>

