关于internvl如何在langchain框架下的使用
您好 我想在langchian框架下 使用internvl 来完成对话 以及memory的记忆 path = "OpenGVLab/InternVL-Chat-Chinese-V1-1"
model = AutoModel.from_pretrained( path, torch_dtype=torch.bfloat16, low_cpu_mem_usage=True, trust_remote_code=True, cache_dir = "/project/ASD/jingyou_llm/model_cache", ).eval().cuda()
tokenizer = AutoTokenizer.from_pretrained(path)
pipe = pipeline( "visual-question-answering", model=model, tokenizer=tokenizer, max_length=100, ) 然后报错:The model 'InternVLChatModel' is not supported for visual-question-answering. Supported models are ['Blip2ForConditionalGeneration', 'ViltForQuestionAnswering']. 但是提供的这两个类型都是不存在的 请问要如何使用呢
请问你解决这个问题了吗,我也想在langchain上使用这个模型
您好,我们目前暂时没有计划支持langchain,您可以尝试在langchain的仓库里提issue。
或者您可以尝试把我们的模型封装成和OpenAI API相同的格式,然后通过langchain调用。
可以用lmdeploy把模型部署成openai,然后接入langchain。
把模型部署成OpenAI API可以按照这个指南:https://internvl.readthedocs.io/en/latest/internvl2.0/deployment.html#serving-with-openai-compatible-server