Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the JanusPro-generation #3221

Merged
merged 25 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
618eaaa
add transformers in gitignore
DaozeZhang Sep 10, 2024
8fd4051
fix a typo bug in text-caps
DaozeZhang Sep 11, 2024
f7a3eea
Merge branch 'modelscope:main' into main
DaozeZhang Sep 20, 2024
add49e5
add .run into gitignore
DaozeZhang Sep 20, 2024
4f43621
Merge commit 'f7a3eeaf0c57a100e985276fa783239f21fa9ee6'
DaozeZhang Sep 20, 2024
40d3ad0
add vlmeval to gitignore
DaozeZhang Sep 30, 2024
a3ae3ca
Merge commit '9bae58c9dc3015855bcd6a75794eb9c3947cb476'
DaozeZhang Sep 30, 2024
818d0fd
add my_model/ to gitignore
DaozeZhang Oct 18, 2024
619a4bd
Merge commit '704381f2e27b29c94b97b7c12d1e8a2dd886fdff'
DaozeZhang Oct 18, 2024
6bbd9f7
Merge branch 'modelscope:main' into main
DaozeZhang Oct 21, 2024
9ce9e9f
Merge branch 'modelscope:main' into main
DaozeZhang Oct 22, 2024
b7afb5e
Merge commit 'd42f8b5c3d3af7ee7ef58ff3ebdcb8ed790afb68'
DaozeZhang Oct 23, 2024
b22f7f3
Merge branch 'modelscope:main' into main
DaozeZhang Oct 23, 2024
9ef7838
Merge commit '44302aba29a8909892322ec18dfdf7398c5cec88'
DaozeZhang Oct 31, 2024
7d45ea3
Merge branch 'modelscope:main' into main
DaozeZhang Oct 31, 2024
e4d420e
Merge commit '53790bd87fb1327f83837a779a55d90e029101d4'
DaozeZhang Nov 8, 2024
a2a5c15
Merge branch 'modelscope:main' into main
DaozeZhang Feb 17, 2025
3017915
Merge commit 'a2a5c15cb2da3e75d11581230e0c310d7c4f5e5b'
DaozeZhang Feb 18, 2025
8926d3d
Merge commit '96eeecc6af0bf3fcfbec564eb6f5d66a8c8e0593'
DaozeZhang Feb 19, 2025
e56efad
Merge branch 'modelscope:main' into main
DaozeZhang Feb 19, 2025
8f09f63
Merge commit '0a327e5248b18e88496cf7284b7049382b3b37d8'
DaozeZhang Feb 21, 2025
b4f5bbe
Merge branch 'modelscope:main' into main
DaozeZhang Feb 21, 2025
b3aa78b
Merge commit 'b4f5bbe257211142a004db89b3ce2493c9514f86'
DaozeZhang Feb 21, 2025
72f6452
update the generation of JanusPro
DaozeZhang Feb 21, 2025
c3ee27a
add `message['role'] == 'user'`
DaozeZhang Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions swift/llm/template/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,11 @@ def _replace_image_tags(inputs: StdTemplateInputs):
def _replace_start_image_tags(inputs: StdTemplateInputs):
# compat
generate_mode = False
for message in inputs.messages:
content = message['content']
if not isinstance(content, str):
continue
if content.strip().endswith('<start-image>'):
generate_mode = True
message['content'] = re.sub('<start-image>', '', content).strip() # remove the <start-image>
message = inputs.messages[-1]
content = message['content']
if message['role'] == 'user' and content.endswith('<start-image>'):
generate_mode = True
message['content'] = message['content'][:-len('<start-image>')] # remove the <start-image>
inputs.generate_mode = generate_mode

def _rlhf_encode(self, inputs: StdTemplateInputs) -> Dict[str, Any]:
Expand Down
5 changes: 1 addition & 4 deletions tests/test_align/test_template/test_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

def test_deepseek_janus_pro_gene():
from swift.llm import infer_main, InferArguments
args = InferArguments(
# model='deepseek-ai/Janus-Pro-1B',
model='/mnt/nas1/.cache/modelscope/hub/deepseek-ai/Janus-Pro-1B',
infer_backend='pt')
args = InferArguments(model='deepseek-ai/Janus-Pro-1B', infer_backend='pt')
infer_main(args)


Expand Down