Any-to-Any
Transformers
Safetensors
nlduni
feature-extraction
custom_code
image-text-to-text
text-to-image
image-to-image
Instructions to use nvidia/NLD-Uni with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/NLD-Uni with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/NLD-Uni", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download conversation.py from nvidia/NLD-Uni: direct link, hf CLI and curl.
- Browser
- Download file 820 Bytes
-
https://huggingface.co/nvidia/NLD-Uni/resolve/main/conversation.py
- Command line
-
hf download hf://nvidia/NLD-Uni/conversation.py
-
curl -L -o conversation.py https://huggingface.co/nvidia/NLD-Uni/resolve/main/conversation.py
820 Bytes
| import copy | |
| class Conversation: | |
| roles = ('<|im_start|>user', '<|im_start|>assistant') | |
| system = '<|im_start|>system\nYou are a helpful language and vision assistant. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language.' | |
| def __init__(self): | |
| self.messages = [] | |
| def copy(self): | |
| return copy.deepcopy(self) | |
| def append_message(self, role, message): | |
| self.messages.append((role, message)) | |
| def get_prompt(self): | |
| text = self.system + '<|im_end|>\n' if self.system else '' | |
| for role, message in self.messages: | |
| text += role + '\n' | |
| if message: | |
| text += message + '<|im_end|>\n' | |
| return text | |
| conv_templates = {'ministral': Conversation()} | |