import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
from transformers import MarianMTModel, MarianTokenizer #Trans Huu
pipe = DiffusionPipeline.from_pretrained("vid", torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
device0 = torch.device("cuda" if torch.cuda.is_available() else "cpu")
pipe.to(device0)
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)
model_trans = "./trans"
tokenizertrans = MarianTokenizer.from_pretrained(model_trans)
modeltrans = MarianMTModel.from_pretrained(model_trans)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
modeltrans.to(device)
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Traceback (most recent call last):
File "D:\Tailieuhoctap\AI\chuabiet\run.py", line 12, in
video_frames = pipe(prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\diffusers\pipelines\text_to_video_synthesis\pipeline_text_to_video_synth.py", line 633, in call
prompt_embeds, negative_prompt_embeds = self.encode_prompt(
^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\diffusers\pipelines\text_to_video_synthesis\pipeline_text_to_video_synth.py", line 279, in encode_prompt
prompt_embeds = self.text_encoder(text_input_ids.to(device), attention_mask=attention_mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 798, in forward
return self.text_model(
^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 703, in forward
encoder_outputs = self.encoder(
^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 630, in forward
layer_outputs = encoder_layer(
^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\transformers\models\clip\modeling_clip.py", line 371, in forward
hidden_states = self.layer_norm1(hidden_states)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\modules\normalization.py", line 196, in forward
return F.layer_norm(
^^^^^^^^^^^^^
File "D:\Tailieuhoctap\AI\chuabiet.venv\Lib\site-packages\torch\nn\functional.py", line 2543, in layer_norm
return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'