-
Notifications
You must be signed in to change notification settings - Fork 904
Support the generation of JanusPro models #3218
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
Conversation
logit_uncond = logits[1::2, :] | ||
|
||
logits = logit_uncond + self.cfg_weight * (logit_cond - logit_uncond) | ||
probs = torch.softmax(logits / self.temperature, dim=-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temperature 从generation_config中获取
swift/llm/template/base.py
Outdated
content = message['content'] | ||
if not isinstance(content, str): | ||
continue | ||
if '<start_image>' in content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endwiths
swift/llm/template/base.py
Outdated
content = message['content'] | ||
if not isinstance(content, str): | ||
continue | ||
if '<start_image>' in content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
中划线;加入special_tokens
swift/llm/template/base.py
Outdated
if '<start_image>' in content: | ||
gene_img = True | ||
message['content'] = re.sub('<start_image>', '', content).strip() # remove the <start_image> | ||
inputs.gene_img = gene_img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用generate_mode吧
cfg_weight: float = 5 | ||
image_token_num_per_image: int = 576 | ||
img_size: int = 384 | ||
patch_size: int = 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cfg_weight, img_size, patch_size 使用get_env_args函数 从环境变量获取好了
content = message['content'] | ||
if not isinstance(content, str): | ||
continue | ||
if content.strip().endswith('<start-image>'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip()去掉吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个的话,用户有可能把<start-image>
放末尾以后会再跟几个空格(比如我经常有这个习惯😂)需要考虑吗
continue | ||
if content.strip().endswith('<start-image>'): | ||
generate_mode = True | ||
message['content'] = re.sub('<start-image>', '', content).strip() # remove the <start-image> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message['content'][:-len('<start-image>')]
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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
路径
…soth_fast_grpo * commit 'df8939818d2b3694d14120d8fb07eea96e5b99a8': (24 commits) GRPO+LMDeploy 0.7 (modelscope#3277) fix lmdeploy (modelscope#3274) compat lmdeploy 0.7 (modelscope#3256) Fix typos (modelscope#3266) Support the base64 format of generated images for JanusPro (modelscope#3265) grpo_countdown & fix format reward (modelscope#3269) fix grpo compat transformers==4.47.* (modelscope#3252) save val_dataset (modelscope#3248) fix grpo single gpu(modelscope#3246) fix grpo npu vllm (modelscope#3242) update docs (modelscope#3243) support muon optimizer (modelscope#3234) support moonlight (modelscope#3232) fix deepseek_vl2 (modelscope#3233) fix docs zh (modelscope#3231) Speed up GRPO (modelscope#3229) update docs (modelscope#3230) fix load args (modelscope#3226) Update the JanusPro-generation (modelscope#3221) Support the generation of JanusPro models (modelscope#3218) ...
PR type
PR information
Support the generation of JanusPro models