-
Use the Correct Model Name:
The model name you're using 'Damo_XR_Lab/cv_rife_video-frame-interpolation' seems to be incorrect. The correct model name in the ModelScope repository is 'damo/cv_rife_video-frame-interpolation'. Model names are case-sensitive, and ensuring the correct casing and spelling is crucial.
Updated Code:
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys
video = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/videos/video_frame_interpolation_test.mp4'
video_frame_interpolation_pipeline = pipeline(Tasks.video_frame_interpolation, model='damo/cv_rife_video-frame-interpolation')
result = video_frame_interpolation_pipeline(video)[OutputKeys.OUTPUT_VIDEO]
print('pipeline: the output video path is {}'.format(result))
-
Update the ModelScope Library:
Ensure that you have the latest version of the ModelScope library installed, as newer pipelines and models might not be available in older versions.
Update Command:
pip install --upgrade modelscope
-
Verify Available Pipelines:
You can check the available pipelines and tasks in your current ModelScope installation:
from modelscope.pipelines import PIPELINES
print(PIPELINES.get_supported_tasks())
print(PIPELINES.get_pipeline_supporting_models(Tasks.video_frame_interpolation))
This will show you the list of tasks and the models available for each task to verify if 'video_frame_interpolation' and 'damo/cv_rife_video-frame-interpolation' are listed.
-
Additional Dependencies:
Some pipelines require additional dependencies. For video processing tasks, you might need libraries like ffmpeg. Ensure it's installed in your environment.
Installation Command:
# For Ubuntu/Debian systems
sudo apt-get install ffmpeg
# For macOS with Homebrew
brew install ffmpeg
-
Check Internet Connection and Access:
Since the model is hosted online, ensure that your environment has access to the internet and can reach the ModelScope servers. Sometimes firewall settings or network restrictions can prevent model downloads.
-
Clear ModelScope Cache:
If you've previously attempted to download or use the model and the download was interrupted, cached files might be corrupted.
Clear Cache Command:
modelscope hub clear-cache
Or manually delete the cache directory, usually located at ~/.cache/modelscope.
-
Example of Full Working Code:
Here’s the complete code with the corrections:
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys
# Video URL
video = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/videos/video_frame_interpolation_test.mp4'
# Initialize the pipeline with the correct model name
video_frame_interpolation_pipeline = pipeline(
task=Tasks.video_frame_interpolation,
model='damo/cv_rife_video-frame-interpolation'
)
# Run the pipeline
result = video_frame_interpolation_pipeline(video)
# Get the output video path
output_video_path = result[OutputKeys.OUTPUT_VIDEO]
print('pipeline: the output video path is {}'.format(output_video_path))