模型的model.py文件是否可以提供?
无论是Github还是HF,好像都没有提供模型的model文件,是否可以提供呢?
您好,请问是否有更详细的文档提供模型的细节,还有tokenizer的设置?
在这个文件中,我没有找到对 generation()
方法,我需要知道这个模型的输入形式,以便更好地使用
因为我在这个文件中找到了一个例子:
>>> from transformers import AutoTokenizer, Qwen2ForCausalLM
>>> model = Qwen2ForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
>>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
>>> prompt = "Hey, are you conscious? Can you talk to me?"
>>> inputs = tokenizer(prompt, return_tensors="pt")
>>> # Generate
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
却有报错:The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask
to obtain reliable results.
我可能需要更详细的模型各层的设置,才能使用它
the generate
method is from the class GenerationMixin
which is provided by transformers
and Qwen2ForCasualLM
inherits.
the transformers
documentation can be found at https://huggingface.co/docs/transformers/
- the conceptual guide of LLM generation: https://huggingface.co/docs/transformers/llm_tutorial
- the API of
generate
: https://huggingface.co/docs/transformers/main_classes/text_generation - the API doc of Qwen2 in
transformers
including tokenizers and models: https://huggingface.co/docs/transformers/model_doc/qwen2
The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results.
This is a warning and most time it could be ignored. Please follow the usage in the model card if it is deemed annoying.