mark new version
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name = "GeneralUtils"
|
name = "GeneralUtils"
|
||||||
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
|
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
|
||||||
authors = ["tonaerospace <tonaerospace.etc@gmail.com>"]
|
authors = ["tonaerospace <tonaerospace.etc@gmail.com>"]
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||||
|
|||||||
@@ -68,25 +68,7 @@ function formatLLMtext_llama3instruct(name::T, text::T;
|
|||||||
|
|
||||||
return formattedtext
|
return formattedtext
|
||||||
end
|
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;
|
function formatLLMtext_qwen(name::T, text::T;
|
||||||
assistantStarter::Bool=true) where {T<:AbstractString}
|
assistantStarter::Bool=true) where {T<:AbstractString}
|
||||||
@@ -116,6 +98,35 @@ function formatLLMtext_qwen(name::T, text::T;
|
|||||||
end
|
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.
|
""" Convert a chat messages in vector of dictionary into LLM model instruct format.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
@@ -153,6 +164,8 @@ function formatLLMtext(messages::Vector{Dict{Symbol, T}}; formatname::String="ll
|
|||||||
# not define yet
|
# not define yet
|
||||||
elseif formatname == "qwen"
|
elseif formatname == "qwen"
|
||||||
formatLLMtext_qwen
|
formatLLMtext_qwen
|
||||||
|
elseif formatname == "phi4"
|
||||||
|
formatLLMtext_phi4
|
||||||
else
|
else
|
||||||
error("$formatname template not define yet")
|
error("$formatname template not define yet")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user