Automatic Speech Recognition
Transformers
Safetensors
English
msp_visual
custom_code
visual-speech-recognition
lip-reading
ctc
VSR
Instructions to use MahmoodAnaam/MSP-VSR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MahmoodAnaam/MSP-VSR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="MahmoodAnaam/MSP-VSR", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCTC model = AutoModelForCTC.from_pretrained("MahmoodAnaam/MSP-VSR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download processing_msp_visual.py from MahmoodAnaam/MSP-VSR: direct link, hf CLI and curl.
- Browser
- Download file 994 Bytes
-
https://huggingface.co/MahmoodAnaam/MSP-VSR/resolve/main/processing_msp_visual.py
- Command line
-
hf download hf://MahmoodAnaam/MSP-VSR/processing_msp_visual.py
-
curl -L -o processing_msp_visual.py https://huggingface.co/MahmoodAnaam/MSP-VSR/resolve/main/processing_msp_visual.py
994 Bytes
| from transformers.processing_utils import ProcessorMixin | |
| class MSPVisualProcessor(ProcessorMixin): | |
| attributes = ["video_processor", "tokenizer"] | |
| video_processor_class = "AutoVideoProcessor" | |
| tokenizer_class = "AutoTokenizer" | |
| def __init__(self, video_processor=None, tokenizer=None, **kwargs): | |
| super().__init__(video_processor, tokenizer, **kwargs) | |
| self.video_processor = video_processor | |
| self.tokenizer = tokenizer | |
| def __call__(self, videos=None, text=None, **kwargs): | |
| if videos is None and text is None: | |
| raise ValueError("Provide at least one of videos or text.") | |
| inputs = super().__call__( | |
| images=None, audio=None, videos=videos, text=text, **kwargs | |
| ) | |
| if "input_ids" in inputs: | |
| inputs["labels"] = inputs.pop("input_ids") | |
| return inputs | |
| def model_input_names(self) -> list[str]: | |
| return ["pixel_values_videos", "padding_mask_videos", "labels"] | |