Instructions to use yuta24/ui-test-vision-2b-alpha with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use yuta24/ui-test-vision-2b-alpha with PEFT:
Task type is invalid.
- MLX
How to use yuta24/ui-test-vision-2b-alpha with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("yuta24/ui-test-vision-2b-alpha") config = load_config("yuta24/ui-test-vision-2b-alpha") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 2,331 Bytes
e379257 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | import sys
from pathlib import Path
import pytest
import torch
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
class FakeTokenizer:
"""Char-level tokenizer (ids = ord % vocab); enough for encode_record / encode_glint_record."""
vocab = 997
pad_token_id = 0
class _Out:
def __init__(self, ids):
self.input_ids = ids
def __call__(self, text, add_special_tokens=False):
return self._Out([1 + ord(c) % (self.vocab - 1) for c in text])
def convert_tokens_to_ids(self, token):
return self.vocab - 1
class FakeBackbone(torch.nn.Module):
"""Stands in for Qwen3_5ForConditionalGeneration: .model(...) -> last_hidden_state, get_output_embeddings()."""
def __init__(self, vocab=FakeTokenizer.vocab, hidden=32):
super().__init__()
class Inner(torch.nn.Module):
def __init__(self):
super().__init__()
self.embed = torch.nn.Embedding(vocab, hidden)
self.mix = torch.nn.Linear(hidden, hidden)
def forward(self, input_ids, attention_mask, use_cache=False, return_dict=True, **media):
class O:
pass
o = O(); o.last_hidden_state = torch.tanh(self.mix(self.embed(input_ids)))
return o
self.model = Inner()
self.lm_head = torch.nn.Linear(hidden, vocab, bias=False)
def get_output_embeddings(self):
return self.lm_head
@pytest.fixture
def tok():
return FakeTokenizer()
@pytest.fixture
def records():
choice = {"screen": {"type": "choice", "instructions": "What screen?", "criteria": {"home": "Home", "error": "Error"}},
"has_error": {"type": "noul", "instructions": "Is an error visible?"}}
box = {"btn": {"type": "box", "instructions": "the primary button in `screen`"},
"btn_visible": {"type": "noul", "instructions": "Is the primary button visible?"},
"badge": {"type": "box", "instructions": "the red badge"}}
return {"choice": {"id": "c", "state": {"app": "X"}, "questions": choice},
"mixed": {"id": "m", "state": "s", "questions": {**choice, **box}},
"box_only": {"id": "b", "state": "s", "questions": {"btn": box["btn"]}}}
|