Skip to content

from modeling_deltalm import DeltalmForConditionalGeneration报错 no known parent package #443

Open
@heiheiheibj

Description

想在本地部署翻译模型,在 Fengshenbang-LM\fengshen\models\deltalm 目录下,执行的代码为官方例子
from modeling_deltalm import DeltalmForConditionalGeneration
from transformers import AutoTokenizer

model = DeltalmForConditionalGeneration.from_pretrained("IDEA-CCNL/Randeng-Deltalm-362M-Zh-En")
tokenizer = AutoTokenizer.from_pretrained("microsoft/infoxlm-base")

text = "尤其在夏天,如果你决定徒步穿越雨林,就需要小心蚊子。"

inputs = tokenizer(text, max_length=512, return_tensors="pt")

generate_ids = model.generate(inputs["input_ids"], max_length=512)
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]

from modeling_deltalm import DeltalmForConditionalGeneration报错
ImportError: attempted relative import with no known parent package

image

谢谢

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions