RUCAIBox / live-bart-base

huggingface.co
Total runs: 4
24-hour runs: 0
7-day runs: -1
30-day runs: -1
Model's Last Updated: November 04 2024
text-generation

Introduction of live-bart-base

Model Details of live-bart-base

LIVE-BART

The LIVE-BART model was proposed in Learning to Imagine: Visually-Augmented Natural Language Generation by Tianyi Tang, Yushuo Chen, Yifan Du, Junyi Li, Wayne Xin Zhao and Ji-Rong Wen.

The detailed information and instructions can be found https://github.com/RUCAIBox/LIVE .

You should install the transformers at https://github.com/RUCAIBox/LIVE .

import torch
import torch.nn as nn
from transformers import BartForConditionalGeneration, AutoModel

class LiveModel(nn.Module):
    def __init__(self):
        super().__init__()

        self.model = BartForConditionalGeneration.from_pretrained('RUCAIBox/live-bart-base', image_fusion_encoder=True)
        self.vision_model = AutoModel.from_pretrained('openai/clip-vit-base-patch32').vision_model
        hidden_size = self.model.config.hidden_size
        self.trans = nn.Sequential(
            nn.Linear(self.vision_model.config.hidden_size, hidden_size * 4),
            nn.ReLU(),
            nn.Linear(hidden_size * 4, hidden_size),
        )

model = LiveModel()
trans = torch.load('trans.bart.pth')
model.trans.load_state_dict(trans)

# kwargs to model.forward() and model.generate()
# input_ids [batch_size, seq_len], same to hugging face
# attention_masks [batch_size, seq_len], same to hugging face
# labels [batch_size, seq_len], same to hugging face
# image_embeds [batch_size, image_num*patch_num, image_hidden_size], should be transfered using `trans`, image_num can be the sentence num of text, patch_num and image_hidden_size are 50 and 768 for openai/clip-vit-base-patch32, respectively
# images_mask [batch_size, seq_len, image_num], this is the mask in Figure 1, 1 represents the i-th word should attend to the j-th image
# images_mask_2d [batch_size, seq_len], 1 represents the i-th word should not be visually augmented, i.e., should not be attend to any image

Runs of RUCAIBox live-bart-base on huggingface.co

4
Total runs
0
24-hour runs
0
3-day runs
-1
7-day runs
-1
30-day runs

More Information About live-bart-base huggingface.co Model

live-bart-base huggingface.co

live-bart-base huggingface.co is an AI model on huggingface.co that provides live-bart-base's model effect (), which can be used instantly with this RUCAIBox live-bart-base model. huggingface.co supports a free trial of the live-bart-base model, and also provides paid use of the live-bart-base. Support call live-bart-base model through api, including Node.js, Python, http.

live-bart-base huggingface.co Url

https://huggingface.co/RUCAIBox/live-bart-base

RUCAIBox live-bart-base online free

live-bart-base huggingface.co is an online trial and call api platform, which integrates live-bart-base's modeling effects, including api services, and provides a free online trial of live-bart-base, you can try live-bart-base online for free by clicking the link below.

RUCAIBox live-bart-base online free url in huggingface.co:

https://huggingface.co/RUCAIBox/live-bart-base

live-bart-base install

live-bart-base is an open source model from GitHub that offers a free installation service, and any user can find live-bart-base on GitHub to install. At the same time, huggingface.co provides the effect of live-bart-base install, users can directly use live-bart-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

live-bart-base install url in huggingface.co:

https://huggingface.co/RUCAIBox/live-bart-base

Url of live-bart-base

live-bart-base huggingface.co Url

Provider of live-bart-base huggingface.co

RUCAIBox
ORGANIZATIONS

Other API from RUCAIBox

huggingface.co

Total runs: 3.2K
Run Growth: -938
Growth Rate: -29.06%
Updated:June 27 2022
huggingface.co

Total runs: 77
Run Growth: 48
Growth Rate: 72.73%
Updated:August 03 2023
huggingface.co

Total runs: 73
Run Growth: 52
Growth Rate: 74.29%
Updated:October 28 2022
huggingface.co

Total runs: 46
Run Growth: 32
Growth Rate: 71.11%
Updated:August 03 2023
huggingface.co

Total runs: 12
Run Growth: 3
Growth Rate: 25.00%
Updated:June 27 2022
huggingface.co

Total runs: 7
Run Growth: 0
Growth Rate: 0.00%
Updated:June 27 2022