当前位置: 首页 > news >正文

网站开发培训达内网站优化要多少钱

网站开发培训达内,网站优化要多少钱,值得浏览的外国网站,做网站公司排名目录 生成视频代码: 维度报错: 解决方法,修改代码: 已开源: 视频生成模型 Zeroscope开源 免费无水印 视频生成模型 Zeroscope_v2_576w 开源 - 腾讯云开发者社区-腾讯云 生成视频代码: import torch fro…

目录

生成视频代码:

维度报错:

解决方法,修改代码:


已开源:

视频生成模型 Zeroscope开源 免费无水印

 

视频生成模型 Zeroscope_v2_576w 开源 - 腾讯云开发者社区-腾讯云

生成视频代码:

import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
import os
# os.environ['HTTP_PROXY'] = 'http://127.0.0.1:7890'os.environ["HF_TOKEN"] = "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"
# os.environ['HTTPS_PROXY'] = 'https://127.0.0.1:7890'# pipe = DiffusionPipeline.from_pretrained(r"D:\360安全浏览器下载", torch_dtype=torch.float16)
pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16,use_auth_token=os.environ["HF_TOKEN"])
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()prompt = "Darth Vader is surfing on waves"
video_frames = pipe(prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames
video_path = export_to_video(video_frames)
print(video_path)

维度报错:

Traceback (most recent call last):File "E:\project\jijia\aaa.py", line 18, in <module>video_path = export_to_video(video_frames)File "D:\ProgramData\miniconda3\envs\pysd\lib\site-packages\diffusers\utils\export_utils.py", line 135, in export_to_videoh, w, c = video_frames[0].shape
ValueError: too many values to unpack (expected 3)

解决方法,修改代码:

def export_to_video(video_frames: Union[List[np.ndarray], List[PIL.Image.Image]], output_video_path: str = None, fps: int = 10
) -> str:if is_opencv_available():import cv2else:raise ImportError(BACKENDS_MAPPING["opencv"][1].format("export_to_video"))if output_video_path is None:output_video_path = tempfile.NamedTemporaryFile(suffix=".mp4").name# Convert PIL images to numpy arrays if neededif isinstance(video_frames[0], PIL.Image.Image):video_frames = [np.array(frame) for frame in video_frames]# Ensure the frames are in the correct formatif isinstance(video_frames[0], np.ndarray):# Check if frames are 4-dimensional and handle accordinglyif len(video_frames[0].shape) == 4:video_frames = [frame[0] for frame in video_frames]# Convert frames to uint8video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames]# Ensure all frames are in (height, width, channels) formath, w, c = video_frames[0].shapefourcc = cv2.VideoWriter_fourcc(*"mp4v")video_writer = cv2.VideoWriter(output_video_path, fourcc, fps=fps, frameSize=(w, h))for frame in video_frames:img = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)video_writer.write(img)video_writer.release()return output_video_pathdef export_to_video_o(video_frames: Union[List[np.ndarray], List[PIL.Image.Image]], output_video_path: str = None, fps: int = 10
) -> str:if is_opencv_available():import cv2else:raise ImportError(BACKENDS_MAPPING["opencv"][1].format("export_to_video"))if output_video_path is None:output_video_path = tempfile.NamedTemporaryFile(suffix=".mp4").nameif isinstance(video_frames[0], np.ndarray):video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames]elif isinstance(video_frames[0], PIL.Image.Image):video_frames = [np.array(frame) for frame in video_frames]fourcc = cv2.VideoWriter_fourcc(*"mp4v")h, w, c = video_frames[0].shapevideo_writer = cv2.VideoWriter(output_video_path, fourcc, fps=fps, frameSize=(w, h))for i in range(len(video_frames)):img = cv2.cvtColor(video_frames[i], cv2.COLOR_RGB2BGR)video_writer.write(img)return output_video_path

http://www.hkea.cn/news/504502/

相关文章:

  • 移动端h5网站开发服务企业seo推广
  • 管理公司网站建设引擎搜索优化
  • 上市公司专利查询网站百度广告投放价格
  • html5电商网页制作网站怎么seo关键词排名优化推广
  • 大同网站建设黄冈网站推广优化找哪家
  • 昌邑网站建设站长之家网站排名
  • 建设企业网站的需求分析免费域名
  • 重庆欧勒精细有限公司网站策划书百度竞价推广开户
  • 怎么做一键添加信任网站ios aso优化工具
  • ps做网站的分辨率多少钱苹果cms永久免费建站程序
  • 网站推广积分常用于网站推广的营销手段是
  • wordpress时间云储存沈阳网站制作优化推广
  • h5响应式网站建设竞价托管哪家效果好
  • 企业解决方案参考网站品牌软文营销案例
  • 做淘客要有好的网站上海百度seo
  • 网站建设 seojsc宁德seo推广
  • 建立网站的作用信息流优化师工作总结
  • 如何建设物流网站近期时事新闻
  • 网站开发大赛发言稿网址搜索
  • 论坛类型的网站怎么做拉新推广平台有哪些
  • pc官方网站视频专用客户端app
  • 成都哪家做网站建设比较好搜索关键词排名查询
  • 无锡网站优化推广广州网站推广运营
  • 电子商务网站开发的步骤短视频seo排名系统
  • 如何用模板做网站视频河北电子商务seo
  • 动态网站代码设计做小程序的公司
  • 网站建设软件开发的新闻北京关键词优化报价
  • 在上海做兼职在哪个网站好百度售后电话人工服务
  • 深圳网站开发招聘谁能给我个网址
  • 长沙做个网站多少钱怎样免费给自己的公司做网站