text-generation-inference OPTForCausalLM在opt_modelling.py中没有为OPTModel提供前缀,

aelbi1ox  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(44)

你好!
OPTForCausalLMopt_modelling.py 中没有将 prefix 传递给 OPTModel,尽管它是一个位置参数。
text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py
第751行到第764行
| | classOPTForCausalLM(OPTPreTrainedModel): |
| | def__init__(self, prefix, config, weights): |
| | super().init(config) |
| | |
| | ifnotprefix: |
| | prefix="model" |
| | else: |
| | prefix=f"{prefix}.model" |
| | |
| | self.model=OPTModel(config, weights) |
| | |
| | self.lm_head=SpeculativeHead.load( |
| | config, prefix=f"{prefix}.decoder.embed_tokens", weights=weights |
| | ) |
text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py
第694行到第698行
| | classOPTModel(OPTPreTrainedModel): |
| | def__init__(self, prefix: str, config: OPTConfig, weights): |
| | super().init(config) |
| | self.decoder=OPTDecoder(prefix, config, weights) |
| | # Initialize weights and apply final processing |

nxowjjhe

nxowjjhe1#

除了在v2.1.1中,OPT的嵌入是通过以下代码加载的:
text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py
第440行到第442行:
| | self.embed_tokens=TensorParallelEmbedding( |
| | prefix="model.decoder.embed_tokens", weights=weights |
| | ) |
这会引发以下错误:

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/opt.py", line 62, in __init__
    model = OPTForCausalLM(config, weights)

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/custom_modeling/opt_modeling.py", line 749, in __init__
    self.model = OPTModel(config, weights)

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/custom_modeling/opt_modeling.py", line 691, in __init__
    self.decoder = OPTDecoder(config, weights)

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/custom_modeling/opt_modeling.py", line 440, in __init__
    self.embed_tokens = TensorParallelEmbedding(

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/layers/tensor_parallel.py", line 230, in __init__
    weight = weights.get_partial_sharded(f"{prefix}.weight", dim=0)

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/utils/weights.py", line 89, in get_partial_sharded
    filename, tensor_name = self.get_filename(tensor_name)

  File "/opt/conda/lib/python3.10/site-packages/text_generation_server/utils/weights.py", line 64, in get_filename
    raise RuntimeError(f"weight {tensor_name} does not exist")

RuntimeError: weight model.decoder.embed_tokens.weight does not exist

尽管主分支上的最新更改似乎仍然会引发错误,因为CausalLM将前缀设置为"",在text-generation-inference/server/text_generation_server/models/causal_lm.py
第556行到第557行:
| | prefix="" |
| | model=model_class(prefix, config, weights) |
前缀变为"model.decoder.embed_tokens"

相关问题