Skip to content

[Question]: 我在实机推理的时候加载模型有问题 #97

@Disembark1

Description

@Disembark1

Question

作者你好!!!
我在实机推理的时候加载模型的时候调用了这个类:
`from internnav.agent.internvla_n1_agent_realworld import InternVLAN1AsyncAgent

MODEL_PATH = "./checkpoints/InternVLA-N1"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

RESIZE_W, RESIZE_H = 384, 384
NUM_HISTORY = 8
args = SimpleNamespace(
model_path=MODEL_PATH,
device=DEVICE,
resize_w=RESIZE_W,
resize_h=RESIZE_H,
num_history=NUM_HISTORY,
)
agent = InternVLAN1AsyncAgent(args)

然后就是代码 internnav/agent/internvla_n1_agent_realworld.py文件里面的类
class InternVLAN1AsyncAgent:
def init(self, args):
self.device = torch.device(args.device)
self.save_dir = "results/" + datetime.now().strftime("%Y%m%d_%H%M%S")

    # 加载预训练模型,并指定相关配置
    self.model = InternVLAN1ForCausalLM.from_pretrained(
        args.model_path,
        torch_dtype=torch.bfloat16,
        attn_implementation="flash_attention_2",
        device_map={"": self.device},
    )

    self.model.eval()
    self.model.to(self.device)

`
但是它一直给我显示这种错误,

Image Image 我试了几种办法,但是还是解决不了问题。 这个是我下载的权重: Image

Metadata

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