mark new version

This commit is contained in:
2025-03-17 09:54:32 +07:00
parent 3082c261c7
commit e6344f1a92
2 changed files with 32 additions and 19 deletions

View File

@@ -68,25 +68,7 @@ function formatLLMtext_llama3instruct(name::T, text::T;
return formattedtext
end
# function formatLLMtext_llama3instruct(name::T, text::T) where {T<:AbstractString}
# formattedtext =
# if name == "system"
# """
# <|begin_of_text|>
# <|start_header_id|>$name<|end_header_id|>
# $text
# <|eot_id|>
# """
# else
# """
# <|start_header_id|>$name<|end_header_id|>
# $text
# <|eot_id|>
# """
# end
# return formattedtext
# end
function formatLLMtext_qwen(name::T, text::T;
assistantStarter::Bool=true) where {T<:AbstractString}
@@ -116,6 +98,35 @@ function formatLLMtext_qwen(name::T, text::T;
end
function formatLLMtext_phi4(name::T, text::T;
assistantStarter::Bool=true) where {T<:AbstractString}
formattedtext =
if name == "system"
"""
<|im_start|>$name<|im_sep|>
$text
<|im_end|>
"""
else
"""
<|im_start|>$name<|im_sep|>
$text
<|im_end|>
"""
end
if assistantStarter
formattedtext *=
"""
<|im_start|>assistant<|im_sep|>
"""
end
return formattedtext
end
""" Convert a chat messages in vector of dictionary into LLM model instruct format.
# Arguments
@@ -153,6 +164,8 @@ function formatLLMtext(messages::Vector{Dict{Symbol, T}}; formatname::String="ll
# not define yet
elseif formatname == "qwen"
formatLLMtext_qwen
elseif formatname == "phi4"
formatLLMtext_phi4
else
error("$formatname template not define yet")
end