BL
r/LocalLLaMA • 5일 전
Qwen3.5 35B 비검열 모델 다양한 포맷 출시
IMP 5/10
핵심 요약
알리바바의 오픈소스 모델 Qwen3.5 35B A3B를 기반으로 한 비검열(UnCensored) 커스텀 모델과 Native MTP(다음 토큰 예측)가 완벽히 보존된 버전이 공개되었습니다. 이 모델은 Safetensors, GGUF, NVFP4, GPTQ-Int4 등 다양한 형식과 양자화 포맷을 지원하여 로컬 환경에서의 활용성을 극대화한 것이 특징입니다.
번역된 본문
[주의: 게시된 원문 본문은 LLM(대형 언어 모델)의 채팅 템플릿 및 토크나이저를 정의하는 코드와 시스템 설정값입니다. 모델의 실제 성능이나 뉴스 내용을 담고 있는 글은 아닙니다.]
텍스트 처리 과정에서 사용되는 특수 토큰(Pad Token, Unk Token)과 챗봇의 응답 형식을 제어하는 Jinja 기반의 채팅 템플릿(Chat Template) 코드로 구성되어 있습니다. 이 코드는 사용자와 AI 모델 간의 대화를 구조화하고, 이미지 및 비디오와 같은 멀티모달 입력값을 처리하며, 외부 함수(도구) 호출 기능(Tool Calling)을 지원하는 등 모델의 기본적인 동작 방식을 정의하고 있습니다.
원문 보기 (영어)
","pad_token":"<|endoftext|>","unk_token":null},"chat_template_jinja":"{%- set image_count = namespace(value=0) %}\r\n{%- set video_count = namespace(value=0) %}\r\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\r\n {%- if content is string %}\r\n {{- content }}\r\n {%- elif content is iterable and content is not mapping %}\r\n {%- for item in content %}\r\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\r\n {%- if is_system_content %}\r\n {{- raise_exception('System message cannot contain images.') }}\r\n {%- endif %}\r\n {%- if do_vision_count %}\r\n {%- set image_count.value = image_count.value + 1 %}\r\n {%- endif %}\r\n {%- if add_vision_id %}\r\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\r\n {%- endif %}\r\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\r\n {%- elif 'video' in item or item.type == 'video' %}\r\n {%- if is_system_content %}\r\n {{- raise_exception('System message cannot contain videos.') }}\r\n {%- endif %}\r\n {%- if do_vision_count %}\r\n {%- set video_count.value = video_count.value + 1 %}\r\n {%- endif %}\r\n {%- if add_vision_id %}\r\n {{- 'Video ' ~ video_count.value ~ ': ' }}\r\n {%- endif %}\r\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\r\n {%- elif 'text' in item %}\r\n {{- item.text }}\r\n {%- else %}\r\n {{- raise_exception('Unexpected item type in content.') }}\r\n {%- endif %}\r\n {%- endfor %}\r\n {%- elif content is none or content is undefined %}\r\n {{- '' }}\r\n {%- else %}\r\n {{- raise_exception('Unexpected content type.') }}\r\n {%- endif %}\r\n{%- endmacro %}\r\n{%- if not messages %}\r\n {{- raise_exception('No messages provided.') }}\r\n{%- endif %}\r\n\r\n{%- set system_rendered = namespace(value=false) %}\r\n\r\n{%- if tools and tools is iterable and tools is not mapping %}\r\n {{- '<|im_start|>system\\n' }}\r\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\r\n {%- for tool in tools %}\r\n {{- \"\\n\" }}\r\n {{- tool | tojson }}\r\n {%- endfor %}\r\n {{- \"\\n</tools>\" }}\r\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\r\n {%- if messages[0].role == 'system' %}\r\n {%- set content = render_content(messages[0].content, false, true)|trim %}\r\n {%- if content %}\r\n {{- '\\n\\n' + content }}\r\n {%- endif %}\r\n {%- endif %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- set system_rendered.value = true %}\r\n{%- else %}\r\n {%- if messages[0].role == 'system' %}\r\n {%- set content = render_content(messages[0].content, false, true)|trim %}\r\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\r\n {%- set system_rendered.value = true %}\r\n {%- endif %}\r\n{%- endif %}\r\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\r\n{%- for message in messages[::-1] %}\r\n {%- set index = (messages|length - 1) - loop.index0 %}\r\n {%- if ns.multi_step_tool and message.role == \"user\" %}\r\n {%- set content = render_content(message.content, false)|trim %}\r\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\r\n {%- set ns.multi_step_tool = false %}\r\n {%- set ns.last_query_index = index %}\r\n {%- endif %}\r\n {%- endif %}\r\n{%- endfor %}\r\n{%- for message in messages %}\r\n {%- if message.role == \"system\" and system_rendered.value and loop.first %}\r\n {%- continue %}\r\n {%- endif %}\r\n {%- set content = render_content(message.content, true)|trim %}\r\n {%- if message.role == \"system\" %}\r\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\r\n {%- elif message.role == \"user\" %}\r\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\r\n {%- elif message.role == \"assistant\" %}\r\n {%- set reasoning_content = '' %}\r\n {%- if message.reasoning_content is string %}\r\n {%- set reasoning_content = message.reasoning_content %}\r\n {%- else %}\r\n {%- if '</think>' in content %}\r\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\r\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\r\n {%- endif %}\r\n {%- endif %}\r\n {%- set reasoning_content = reasoning_content|trim %}\r\n {%- if loop.index0 > ns.last_query_index %}\r\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\r\n {%- else %}\r\n {{- '<|im_start|>' + message.role + '\\n' + content }}\r\n {%- endif %}\r\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\r\n {%- for tool_call in message.tool_calls %}\r\n {%- if tool_call.function is defined %}\r\n {%- set tool_call = tool_call.function %}\r\n {%- endif %}\r\n {%- if loop.first %}\r\n {%- if content|trim %}\r\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- else %}\r\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- endif %}\r\n {%- else %}\r\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- endif %}\r\n {%- if tool_call.arguments is defined %}\r\n {%- for args_name, args_value in tool_call.arguments|items %}\r\n {{- '<parameter=' + args_name + '>\\n' }}\r\n {%- set args_value = args_value | tojson if args_value is mapping or (args_value is iterable and args_value is not string) else args_value | string %}\r\n {{- args_value }}\r\n {{- '\\n</parameter>\\n' }}\r\n {%- endfor %}\r\n {%- endif %}\r\n {{- '</function>\\n</tool_call>' }}\r\n {%- endfor %}\r\n {%- endif %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- elif message.role == \"tool\" %}\r\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\r\n {{- '<|im_start|>user' }}\r\n {%- endif %}\r\n {{- '\\n<tool_response>\\n' }}\r\n {{- content }}\r\n {{- '\\n</tool_response>' }}\r\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- elif loop.last %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- endif %}\r\n {%- else %}\r\n {{- raise_exception('Unexpected message role.') }}\r\n {%- endif %}\r\n{%- endfor %}\r\n{%- if add_generation_prompt %}\r\n {{- '<|im_start|>assistant\\n' }}\r\n {%- if enable_thinking is defined and enable_thinking is false %}\r\n {{- '<think>\\n\\n</think>\\n\\n' }}\r\n {%- else %}\r\n {{- '<think>\\n' }}\r\n {%- endif %}\r\n{%- endif %}"},"createdAt":"2026-05-24T21:01:29.000Z","discussionsDisabled":false,"discussionsSorting":"recently-created","downloads":123,"downloadsAllTime":123,"id":"llmfan46/Qwen3.5-35B-A3B-uncensored-heretic-v2-Native-MTP-Preserved","isLikedByUser":false,"availableInferenceProviders":[],"showHuggingChatEntry":false,"inference":"","lastModified":"2026-05-26T06:58:18.000Z","likes":0,"pipeline_tag":"image-text-to-text","library_name":"transformers","librariesOther":[],"trackDownloads":true,"model-index":null,"private":false,"repoType":"model","gated":false,"tags":["transformers","safetensors","qwen3_5_moe","image-text-to-text","heretic","uncensored","decensored","abliterated","mpoa","mtp","conversational","base_model:Qwen/Qwen3.5-35B-A3B","base_model:finetune:Qwen/Qwen3.5-35B-A3B","license:apache-2.0","endpoints_compatible","region:us"],"tag_objs":[{"id":"image-text