Llama-Guard-3-1B-int4-asym-ov / openvino_detokenizer.xml
tjellm's picture
Upload folder using huggingface_hub
458ad80 verified
raw
history blame
11.4 kB
<?xml version="1.0"?>
<net name="detokenizer" version="11">
<layers>
<layer id="0" name="Parameter_127966" type="Parameter" version="opset1">
<data shape="?,?" element_type="i64" />
<output>
<port id="0" precision="I64" names="Parameter_127966">
<dim>-1</dim>
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="1" name="Convert_127982" type="Convert" version="opset1">
<data destination_type="i32" />
<input>
<port id="0" precision="I64">
<dim>-1</dim>
<dim>-1</dim>
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>-1</dim>
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="2" name="Constant_127861" type="Const" version="opset1">
<data element_type="u8" shape="1586436" offset="0" size="1586436" />
<output>
<port id="0" precision="U8">
<dim>1586436</dim>
</port>
</output>
</layer>
<layer id="3" name="StringTensorUnpack_127862" type="StringTensorUnpack" version="extension">
<data mode="begins_ends" />
<input>
<port id="0" precision="U8">
<dim>1586436</dim>
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>-1</dim>
</port>
<port id="2" precision="I32">
<dim>-1</dim>
</port>
<port id="3" precision="U8">
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="4" name="VocabDecoder_127967" type="VocabDecoder" version="extension">
<data skip_tokens="128000, 128001, 128002, 128003, 128004, 128005, 128006, 128007, 128008, 128009, 128010, 128011, 128012, 128013, 128014, 128015, 128016, 128017, 128018, 128019, 128020, 128021, 128022, 128023, 128024, 128025, 128026, 128027, 128028, 128029, 128030, 128031, 128032, 128033, 128034, 128035, 128036, 128037, 128038, 128039, 128040, 128041, 128042, 128043, 128044, 128045, 128046, 128047, 128048, 128049, 128050, 128051, 128052, 128053, 128054, 128055, 128056, 128057, 128058, 128059, 128060, 128061, 128062, 128063, 128064, 128065, 128066, 128067, 128068, 128069, 128070, 128071, 128072, 128073, 128074, 128075, 128076, 128077, 128078, 128079, 128080, 128081, 128082, 128083, 128084, 128085, 128086, 128087, 128088, 128089, 128090, 128091, 128092, 128093, 128094, 128095, 128096, 128097, 128098, 128099, 128100, 128101, 128102, 128103, 128104, 128105, 128106, 128107, 128108, 128109, 128110, 128111, 128112, 128113, 128114, 128115, 128116, 128117, 128118, 128119, 128120, 128121, 128122, 128123, 128124, 128125, 128126, 128127, 128128, 128129, 128130, 128131, 128132, 128133, 128134, 128135, 128136, 128137, 128138, 128139, 128140, 128141, 128142, 128143, 128144, 128145, 128146, 128147, 128148, 128149, 128150, 128151, 128152, 128153, 128154, 128155, 128156, 128157, 128158, 128159, 128160, 128161, 128162, 128163, 128164, 128165, 128166, 128167, 128168, 128169, 128170, 128171, 128172, 128173, 128174, 128175, 128176, 128177, 128178, 128179, 128180, 128181, 128182, 128183, 128184, 128185, 128186, 128187, 128188, 128189, 128190, 128191, 128192, 128193, 128194, 128195, 128196, 128197, 128198, 128199, 128200, 128201, 128202, 128203, 128204, 128205, 128206, 128207, 128208, 128209, 128210, 128211, 128212, 128213, 128214, 128215, 128216, 128217, 128218, 128219, 128220, 128221, 128222, 128223, 128224, 128225, 128226, 128227, 128228, 128229, 128230, 128231, 128232, 128233, 128234, 128235, 128236, 128237, 128238, 128239, 128240, 128241, 128242, 128243, 128244, 128245, 128246, 128247, 128248, 128249, 128250, 128251, 128252, 128253, 128254, 128255" />
<input>
<port id="0" precision="I32">
<dim>-1</dim>
<dim>-1</dim>
</port>
<port id="1" precision="I32">
<dim>-1</dim>
</port>
<port id="2" precision="I32">
<dim>-1</dim>
</port>
<port id="3" precision="U8">
<dim>-1</dim>
</port>
</input>
<output>
<port id="4" precision="I32">
<dim>-1</dim>
</port>
<port id="5" precision="I32">
<dim>-1</dim>
</port>
<port id="6" precision="I32">
<dim>-1</dim>
</port>
<port id="7" precision="I32">
<dim>-1</dim>
</port>
<port id="8" precision="U8">
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="5" name="CharsToBytes_127968" type="CharsToBytes" version="extension">
<input>
<port id="0" precision="I32">
<dim>-1</dim>
</port>
<port id="1" precision="I32">
<dim>-1</dim>
</port>
<port id="2" precision="I32">
<dim>-1</dim>
</port>
<port id="3" precision="I32">
<dim>-1</dim>
</port>
<port id="4" precision="U8">
<dim>-1</dim>
</port>
</input>
<output>
<port id="5" precision="I32">
<dim>-1</dim>
</port>
<port id="6" precision="I32">
<dim>-1</dim>
</port>
<port id="7" precision="U8">
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="6" name="Constant_127970" type="Const" version="opset1">
<data element_type="u8" shape="47" offset="1586436" size="47" />
<output>
<port id="0" precision="U8">
<dim>47</dim>
</port>
</output>
</layer>
<layer id="7" name="Constant_127972" type="Const" version="opset1">
<data element_type="u8" shape="2" offset="1586483" size="2" />
<output>
<port id="0" precision="U8">
<dim>2</dim>
</port>
</output>
</layer>
<layer id="8" name="RegexNormalization_127973" type="RegexNormalization" version="extension">
<data global_replace="true" />
<input>
<port id="0" precision="I32">
<dim>-1</dim>
</port>
<port id="1" precision="I32">
<dim>-1</dim>
</port>
<port id="2" precision="U8">
<dim>-1</dim>
</port>
<port id="3" precision="U8">
<dim>47</dim>
</port>
<port id="4" precision="U8">
<dim>2</dim>
</port>
</input>
<output>
<port id="5" precision="I32">
<dim>-1</dim>
</port>
<port id="6" precision="I32">
<dim>-1</dim>
</port>
<port id="7" precision="U8">
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="9" name="StringTensorPack_127974" type="StringTensorPack" version="extension">
<data mode="begins_ends" />
<input>
<port id="0" precision="I32">
<dim>-1</dim>
</port>
<port id="1" precision="I32">
<dim>-1</dim>
</port>
<port id="2" precision="U8">
<dim>-1</dim>
</port>
</input>
<output>
<port id="3" precision="STRING" names="string_output">
<dim>-1</dim>
</port>
</output>
</layer>
<layer id="10" name="Result_127975" type="Result" version="opset1">
<input>
<port id="0" precision="STRING">
<dim>-1</dim>
</port>
</input>
</layer>
</layers>
<edges>
<edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
<edge from-layer="1" from-port="1" to-layer="4" to-port="0" />
<edge from-layer="2" from-port="0" to-layer="3" to-port="0" />
<edge from-layer="3" from-port="1" to-layer="4" to-port="1" />
<edge from-layer="3" from-port="2" to-layer="4" to-port="2" />
<edge from-layer="3" from-port="3" to-layer="4" to-port="3" />
<edge from-layer="4" from-port="8" to-layer="5" to-port="4" />
<edge from-layer="4" from-port="7" to-layer="5" to-port="3" />
<edge from-layer="4" from-port="6" to-layer="5" to-port="2" />
<edge from-layer="4" from-port="5" to-layer="5" to-port="1" />
<edge from-layer="4" from-port="4" to-layer="5" to-port="0" />
<edge from-layer="5" from-port="5" to-layer="8" to-port="0" />
<edge from-layer="5" from-port="6" to-layer="8" to-port="1" />
<edge from-layer="5" from-port="7" to-layer="8" to-port="2" />
<edge from-layer="6" from-port="0" to-layer="8" to-port="3" />
<edge from-layer="7" from-port="0" to-layer="8" to-port="4" />
<edge from-layer="8" from-port="5" to-layer="9" to-port="0" />
<edge from-layer="8" from-port="6" to-layer="9" to-port="1" />
<edge from-layer="8" from-port="7" to-layer="9" to-port="2" />
<edge from-layer="9" from-port="3" to-layer="10" to-port="0" />
</edges>
<rt_info>
<bos_token_id value="128000" />
<chat_template value="{%- if messages|length % 2 == 0 -%}&#10; {%- set role = 'Agent' -%}&#10;{%- else -%}&#10; {%- set role = 'User' -%}&#10;{%- endif -%}&#10;{%- if categories is not defined -%}&#10; {%- &#10; set categories = ({&#10; &quot;S1&quot;: &quot;Violent Crimes.&quot;,&#10; &quot;S2&quot;: &quot;Non-Violent Crimes.&quot;,&#10; &quot;S3&quot;: &quot;Sex Crimes.&quot;,&#10; &quot;S4&quot;: &quot;Child Exploitation.&quot;,&#10; &quot;S5&quot;: &quot;Defamation.&quot;,&#10; &quot;S6&quot;: &quot;Specialized Advice.&quot;,&#10; &quot;S7&quot;: &quot;Privacy.&quot;,&#10; &quot;S8&quot;: &quot;Intellectual Property.&quot;,&#10; &quot;S9&quot;: &quot;Indiscriminate Weapons.&quot;,&#10; &quot;S10&quot;: &quot;Hate.&quot;,&#10; &quot;S11&quot;: &quot;Self-Harm.&quot;,&#10; &quot;S12&quot;: &quot;Sexual Content.&quot;,&#10; &quot;S13&quot;: &quot;Elections.&quot;,&#10; })&#10; -%}&#10;{%- endif -%}&#10;&#10;{{- &quot;&lt;|begin_of_text|>&lt;|start_header_id|>user&lt;|end_header_id|>\n\n&quot; -}}&#10;{%- set ns = namespace(contains_image=false) -%}&#10;{%- for message in messages -%}&#10; {%- for content in message['content'] | selectattr('type', 'equalto', 'image') -%}&#10; {%- set ns.contains_image = true -%}&#10; {%- endfor -%}&#10;{%- endfor -%}&#10;{%- if ns.contains_image -%}&#10;{{- &quot;&lt;|image|> &quot;-}}&#10;{%- endif -%}&#10;{{- &quot;Task: Check if there is unsafe content in '&quot; + role + &quot;' messages in conversations according our safety policy with the below categories.\n\n&quot; -}}&#10;{{- &quot;&lt;BEGIN UNSAFE CONTENT CATEGORIES>\n&quot;-}}&#10;&#10;{%- for key in categories -%}&#10; {%- if key not in excluded_category_keys -%}&#10; {{-key + &quot;: &quot; + categories[key] + &quot;\n&quot; -}}&#10; {%- endif -%}&#10;{%- endfor -%}&#10;&#10;{{- &quot;&lt;END UNSAFE CONTENT CATEGORIES>\n\n&quot;-}}&#10;{{- &quot;&lt;BEGIN CONVERSATION>\n\n&quot;-}}&#10;{%- for message in messages -%}&#10; {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}&#10; {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...')-}}&#10; {%- endif -%}&#10; {%- set content = message['content'] -%}&#10; {%- if message['role'] == 'user' -%}&#10; {%- set role = 'User' -%}&#10; {%- elif message['role'] == 'assistant' -%}&#10; {%- set role = 'Agent' -%}&#10; {%- endif -%}&#10; {%- for content in message['content'] | selectattr('type', 'equalto', 'text') -%}&#10;{{- role + ': ' + content['text'] | trim + '\n\n'-}}&#10; {%- endfor -%}&#10;{%- endfor -%}&#10;{{- &quot;&lt;END CONVERSATION>\n\n&quot;-}}&#10;{{- &quot;Provide your safety assessment for ONLY THE LAST &quot; + role + &quot; message in the above conversation:\n&quot;-}}&#10;{{- &quot; - First line must read 'safe' or 'unsafe'.\n&quot;-}}&#10;{{- &quot; - If unsafe, a second line must include a comma-separated list of violated categories. &lt;|eot_id|>&lt;|start_header_id|>assistant&lt;|end_header_id|>&quot;-}}&#10;" />
<eos_token_id value="128009" />
<original_tokenizer_class value="&lt;class 'transformers.tokenization_utils_fast.PreTrainedTokenizerFast'>" />
</rt_info>
</net>