Code Monkey home page Code Monkey logo

yi_vl_experiment's Introduction

本项目是关于Yi的多模态系列模型,如Yi-VL-6B/34B等的实验与应用。

模型推理

以命令行(CLI)的模型进行模型推理,需要将图片下载至images文件夹,同时将single_inference.py略作调整,以支持多次提问。

运行命令如下:

CUDA_VISIBLE_DEVICES=0 python single_inference.py --model-path /data-ai/usr/models/Yi-VL-34B --image-file images/cats.jpg --question "How many cats are there in this image?"

模型推理时使用一张A100(显存80G)就可满足推理要求。

示例图片如下:

示例图片

回复结果如下:

Yi-VL-34B模型回复

可视化模型问答

基于此,我们将会用gradio模块,对Yi-VL-34B模型和GPT-4V模型的结果进行对比。

Python代码参考gradio_server.py.

以下是对不同模型和问题的回复:

  • 图片:taishan.jpg,问题:这张图片是**的哪座山?

  • 图片:dishini.jpg,问题:这张图片是哪个景点的logo?

  • 图片:fruit.jpg,问题:详细描述下这张图片

  • 图片:football.jpg,问题:图片中一个有几个人,他们在干什么?

  • 图片:cartoon.jpg,问题:这张图片是哪部日本的动漫?

从以上的几个测试用例来看,Yi-VL-34B模型的效果很不错,但对比GPT-4V模型,不管在图片理解,还是模型的回答上,仍有一定的差距。

最后,我们来看一个验证码的例子(因为GPT-4V是不能用来破解验证码的!)

可以看到,Yi-VL-34B模型在尝试回答,但给出了错误答案,而GPT-4V模型则会报错,报错信息如下:

{
  "error": {
    "message": "Your input image may contain content that is not allowed by our safety system.",
    "type": "invalid_request_error",
    "param": null,
    "code": "content_policy_violation"
  }
}

无疑,GPT-4V模型这样的设计是合情合理的。

yi_vl_experiment's People

Contributors

jclian91 avatar

Stargazers

Nanuion avatar LLI Hufei avatar  avatar Alpha avatar  avatar  avatar  avatar  avatar fun_dl avatar FunAI avatar  avatar XtalPi Innovation Center avatar

Watchers

Jclian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.