Skip to content

Conversation

DaozeZhang
Copy link
Collaborator

@DaozeZhang DaozeZhang commented Feb 21, 2025

PR type

  • Document Updates
  • More Models or Datasets Support

PR information

Support the generation of JanusPro models

logit_uncond = logits[1::2, :]

logits = logit_uncond + self.cfg_weight * (logit_cond - logit_uncond)
probs = torch.softmax(logits / self.temperature, dim=-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temperature 从generation_config中获取

content = message['content']
if not isinstance(content, str):
continue
if '<start_image>' in content:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endwiths

content = message['content']
if not isinstance(content, str):
continue
if '<start_image>' in content:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中划线;加入special_tokens

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
Copy link
Collaborator

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
Copy link
Collaborator

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>'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip()去掉吧

Copy link
Collaborator Author

@DaozeZhang DaozeZhang Feb 21, 2025

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>
Copy link
Collaborator

@Jintao-Huang Jintao-Huang Feb 21, 2025

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',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

路径

@DaozeZhang DaozeZhang merged commit 0a327e5 into modelscope:main Feb 21, 2025
2 checks passed
@DaozeZhang DaozeZhang deleted the JanusPro-gene branch February 21, 2025 16:57
tastelikefeet added a commit to tastelikefeet/swift that referenced this pull request Feb 26, 2025
…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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants