|
Download README.md from REDSCARE/NEWCHATGPT: direct link, hf CLI and curl.
- Browser
- Download file 858 Bytes
-
https://huggingface.co/REDSCARE/NEWCHATGPT/resolve/main/README.md
- Command line
-
hf download hf://REDSCARE/NEWCHATGPT/README.md
-
curl -L -o README.md https://huggingface.co/REDSCARE/NEWCHATGPT/resolve/main/README.md
858 Bytes
license: other ---pip install transformers torch torchvision from transformers import T5ForConditionalGeneration, T5Tokenizer import torch import torchvision.transforms as transforms from torchvision.io import write_video model = T5ForConditionalGeneration.from_pretrained("t5-base") tokenizer = T5Tokenizer.from_pretrained("t5-base") device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = model.to(device) def generate_video_from_text(text): input_ids = tokenizer.encode(text, return_tensors="pt").to(device) output = model.generate(input_ids) video_frames = output[0].cpu().numpy()
# Convert frames to a video
frames = [torch.tensor(frame, dtype=torch.uint8).permute(1, 2, 0) for frame in video_frames]
video = torch.stack(frames)
video = video.permute(0, 3, 1, 2) # (T, C, H, W)
return video