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

可以根据AutoProcessor或者输入的message来确定image_start与image_end参数吗? #47

Open
Tian-ye1214 opened this issue Nov 10, 2024 · 4 comments

Comments

@Tian-ye1214
Copy link

作者您好,感谢您的工作!

是否可以根据transformer库的AutoProcessor确定image_start等参数?
例如我的输入是
messages = [ { "role": "user", "content": [ {"type": "image", "image": "", }, {"type": "text", "text": "Please describe this image in detail."}, ], } ]
AutoProcessor的输出是:
['<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>Please describe this image in detail.<|im_end|>\n<|im_start|>assistant\n']
这是否意味着我的image_start=11,image_end=13。如果不是,我应该如何根据AutoModel函数来确定image_start等参数?

感谢您的回复!

@Tian-ye1214
Copy link
Author

另外,如果按照image_start=11,image_end=13的设置,会发生报错“ValueError: max_length needs to be a stopping_criteria for now.” :(

@shikiw
Copy link
Owner

shikiw commented Nov 12, 2024

您好,感谢您对我们工作的认可!

  1. image_start,image_end不是指special token的位置,例如在你给的例子中,image_start,image_end分别指第一个<|image_pad|>和最后一个<|image_pad|>的位置。可以参考Questions about the IM_START and IM_END tokens #2

  2. 可以提供一下报错的位置吗?感谢

@Tian-ye1214
Copy link
Author

您好,感谢您对我们工作的认可!

  1. image_start,image_end不是指special token的位置,例如在你给的例子中,image_start,image_end分别指第一个<|image_pad|>和最后一个<|image_pad|>的位置。可以参考Questions about the IM_START and IM_END tokens #2
  2. 可以提供一下报错的位置吗?感谢

感谢您的回复!
第一个问题我理解了,感谢!还有个小问题是response_start参数是AutoProcessor的总长度吗?
第二个问题,报错发生在transformers库的utils.py第1628行:

        if stopping_criteria.max_length is None:
            raise ValueError("`max_length` needs to be a stopping_criteria for now.")

@shikiw
Copy link
Owner

shikiw commented Nov 21, 2024

您好,

  1. response_start是模型回答开始的首个token的位置
  2. 你确认一下generate的参数里有没有设置max_length

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

No branches or pull requests

2 participants