Text Generation
Transformers
Safetensors
English
mistral
text-to-video generation
VidProM
Automatical text-to-video prompt
text-generation-inference
Instructions to use WenhaoWang/AutoT2VPrompt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WenhaoWang/AutoT2VPrompt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WenhaoWang/AutoT2VPrompt")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WenhaoWang/AutoT2VPrompt") model = AutoModelForCausalLM.from_pretrained("WenhaoWang/AutoT2VPrompt", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WenhaoWang/AutoT2VPrompt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WenhaoWang/AutoT2VPrompt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WenhaoWang/AutoT2VPrompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/WenhaoWang/AutoT2VPrompt
- SGLang
How to use WenhaoWang/AutoT2VPrompt with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "WenhaoWang/AutoT2VPrompt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WenhaoWang/AutoT2VPrompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "WenhaoWang/AutoT2VPrompt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WenhaoWang/AutoT2VPrompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use WenhaoWang/AutoT2VPrompt with Docker Model Runner:
docker model run hf.co/WenhaoWang/AutoT2VPrompt
metadata
license: cc-by-nc-4.0
datasets:
- WenhaoWang/VidProM
language:
- en
pipeline_tag: text-generation
tags:
- text-to-video generation
- VidProM
- Automatical text-to-video prompt
The first model for automatic text-to-video prompt completion: Given a few words as input, the model will generate a few whole text-to-video prompts.
Details
It is fine-tuned on the VidProM dataset using Mistral-7B-v0.1 and 8 A100 GPUs.
Usage
Download the model
from transformers import pipeline
import torch
pipe = pipeline("text-generation", model="WenhaoWang/AutoT2VPrompt", model_kwargs={"torch_dtype": torch.bfloat16}, device_map="cuda:0")
Set the Parameters
input = "An underwater world" # The input text to generate text-to-video prompt.
max_length = 50 # The maximum length of the generated text.
temperature = 1.2 # Controls the randomness of the generation. Higher values lead to more random outputs.
top_k = 8 # Limits the number of words considered at each step to the top k most likely words.
num_return_sequences = 10 # The number of different text-to-video prompts to generate from the same input.
Generation
all_prompts = pipe(input, max_length = max_length, do_sample = True, temperature = temperature, top_k = top_k, num_return_sequences=num_return_sequences)
def process(text):
text = text.replace('\n', '.')
text = text.replace(' .', '.')
text = text[:text.rfind('.')]
text = text + '.'
return text
for i in range(num_return_sequences):
print(process(all_prompts[i]['generated_text']))
You will get 10 text-to-video prompts, and you can pick one you like most.
An underwater world, 25 ye boy, with aqua-green eyes, dk sandy blond hair, from the back, and on his back a fish, 23 ye old, weing glasses,ctoon chacte.
An underwater world, the video should capture the essence of tranquility and the beauty of nature.. a woman with short hair weing a green dress sitting at the desk.
An underwater world, the ocean is full of discded items, the water flows, and the light penetrating through the water.
An underwater world.. a woman with red eyes and red lips is looking forwd.
An underwater world.. an old man sitting in a chair, smoking a pipe, a little smoke coming out of the chair, a man is drinking a glass.
An underwater world. The ocean is filled with bioluminess as the water reflects a soft glow from a bioluminescent phosphorescent light source. The camera slowly moves away and zooms in..
An underwater world. the girl looks at the camera and smiles with happiness..
An underwater world, 1960s horror film..
An underwater world.. 4 men in 1940s style clothes walk ound a gothic castle. night, fe. A girl is running, and there e some flowers along the river.
An underwater world, -camera pan up . A girl is playing with her cat on a sunny day in the pk. A man is running and then falling down and dying.
License
The model is licensed under the CC BY-NC 4.0 license.
Citation
@article{wang2024vidprom,
title={VidProM: A Million-scale Real Prompt-Gallery Dataset for Text-to-Video Diffusion Models},
author={Wang, Wenhao and Yang, Yi},
journal={arXiv preprint arXiv:2403.06098},
year={2024}
}
Acknowledgment
The fine-tuning process is helped by Yaowei Zheng.
Contact
If you have any questions, feel free to contact Wenhao Wang (wangwenhao0716@gmail.com).