Downloads · 30 days
23
14% of all-time downloads
AmrMKayid/synchformer-hf
synchformer-hf is a machine learning model from AmrMKayid. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a Synchformer model for audio-visual synchronization. The model predicts the offset between audio and video tracks.
Downloads · 30 days
23
14% of all-time downloads
All-time downloads
163
Public
Repo size
2.7 GB
Likes
0
Public
Click a slice to open those files.
.pt1.2 GB · 60%
From the Hugging Face model README
This repository contains a Synchformer model for audio-visual synchronization. The model predicts the offset between audio and video tracks.
import torch
import os
import sys
# Add the current directory to the path
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
# Import the auto factory to register the model
import auto_factory
# Now you can use the model with transformers
from transformers import AutoConfig, AutoModel
# Load the model
model = AutoModel.from_pretrained("AmrMKayid/synchformer-hf")
model.to("cuda" if torch.cuda.is_available() else "cpu")
# Predict offset for a video
results = model.predict_offset(
"path/to/your/video.mp4",
offset_sec=0.0, # Ground truth offset (if known)
v_start_i_sec=0.0 # Start time in seconds for video
)
# Print results
print("\nPrediction Results:")
for pred in results["predictions"]:
print(f'p={pred["probability"]:.4f}, "{pred["offset_sec"]:.2f}" (class {pred["class_idx"]})')
This model is based on the Synchformer architecture, which uses a transformer to predict the offset between audio and video tracks.