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
Download code/tests/conftest.py from yuta24/ui-test-vision-2b-alpha: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/yuta24/ui-test-vision-2b-alpha/resolve/main/code/tests/conftest.py
- Command line
-
hf download hf://yuta24/ui-test-vision-2b-alpha/code/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/yuta24/ui-test-vision-2b-alpha/resolve/main/code/tests/conftest.py
2.33 kB
| 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 | |
| def tok(): | |
| return FakeTokenizer() | |
| 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"]}}} | |