Feature Extraction
Transformers
English
qwen2_5_omni_thinker
text-generation
multimodal-embedding
any-to-any-retrieval
text-image-retrieval
video-retrieval
audio-retrieval
qwen2.5-omni
Instructions to use Sony/OmniUE-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sony/OmniUE-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Sony/OmniUE-3B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Sony/OmniUE-3B") model = AutoModelForSeq2SeqLM.from_pretrained("Sony/OmniUE-3B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download examples/retrieve.py from Sony/OmniUE-3B: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/Sony/OmniUE-3B/resolve/main/examples/retrieve.py
- Command line
-
hf download hf://Sony/OmniUE-3B/examples/retrieve.py
-
curl -L -o retrieve.py https://huggingface.co/Sony/OmniUE-3B/resolve/main/examples/retrieve.py
1.01 kB
| """Retrieve caption candidates with an OmniUE text, image, video, or audio query.""" | |
| from __future__ import annotations | |
| import argparse | |
| from omniue import OmniUE | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--model", default=".") | |
| parser.add_argument("--video") | |
| args = parser.parse_args() | |
| model = OmniUE.from_pretrained(args.model) | |
| candidates = [ | |
| "A person plays a guitar on a stage.", | |
| "A dog runs across a field.", | |
| "A chef chops vegetables in a kitchen.", | |
| ] | |
| corpus = model.encode_text(candidates) | |
| query = ( | |
| model.encode_video(args.video, instruction="Find the matching description.") | |
| if args.video | |
| else model.encode_text("A musician performing with a guitar.") | |
| ) | |
| indices, scores = model.cosine_topk(query, corpus, k=len(candidates)) | |
| for index, score in zip(indices[0], scores[0]): | |
| print(f"{score:.4f} {candidates[index]}") | |
| if __name__ == "__main__": | |
| main() | |