Image-Text-to-Text
Transformers
English
Chinese
eviscene
multimodal
image-factuality
agent
sft
distillation
Instructions to use ZiAnwang/EviScene with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ZiAnwang/EviScene with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ZiAnwang/EviScene")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ZiAnwang/EviScene", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ZiAnwang/EviScene with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ZiAnwang/EviScene" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZiAnwang/EviScene", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ZiAnwang/EviScene
- SGLang
How to use ZiAnwang/EviScene with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ZiAnwang/EviScene" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZiAnwang/EviScene", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ZiAnwang/EviScene" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZiAnwang/EviScene", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ZiAnwang/EviScene with Docker Model Runner:
docker model run hf.co/ZiAnwang/EviScene
Download eviscene/integrations/async_runtime.py from ZiAnwang/EviScene: direct link, hf CLI and curl.
- Browser
- Download file 4.35 kB
-
https://huggingface.co/ZiAnwang/EviScene/resolve/main/eviscene/integrations/async_runtime.py
- Command line
-
hf download hf://ZiAnwang/EviScene/eviscene/integrations/async_runtime.py
-
curl -L -o async_runtime.py https://huggingface.co/ZiAnwang/EviScene/resolve/main/eviscene/integrations/async_runtime.py
4.35 kB
| """Small persistent asyncio runtime for synchronous tool adapters.""" | |
| from __future__ import annotations | |
| import asyncio | |
| import threading | |
| from typing import Any, Awaitable, Callable, Optional | |
| class PersistentAsyncRuntime: | |
| """Run concurrent coroutines on one long-lived asyncio event loop. | |
| Synchronous tools call :meth:`run` from worker threads. A single event loop | |
| keeps one async HTTP transport reusable while ``run_coroutine_threadsafe`` | |
| still allows independent requests to overlap. | |
| """ | |
| def __init__(self, *, thread_name: str) -> None: | |
| self._lock = threading.Lock() | |
| self._ready = threading.Event() | |
| self._closed = False | |
| self._startup_error: Optional[BaseException] = None | |
| self._loop: Optional[asyncio.AbstractEventLoop] = None | |
| self._thread: Optional[threading.Thread] = None | |
| self._thread_name = thread_name | |
| def run(self, coroutine: Awaitable[Any]) -> Any: | |
| self._ensure_started() | |
| with self._lock: | |
| if self._closed: | |
| raise RuntimeError("Persistent asyncio runtime is closed.") | |
| loop = self._loop | |
| if loop is None: | |
| raise RuntimeError("Persistent asyncio runtime is not ready.") | |
| return asyncio.run_coroutine_threadsafe(coroutine, loop).result() | |
| def closed(self) -> bool: | |
| with self._lock: | |
| return self._closed | |
| def close( | |
| self, | |
| cleanup_factory: Optional[Callable[[], Awaitable[Any]]] = None, | |
| ) -> None: | |
| with self._lock: | |
| if self._closed: | |
| return | |
| self._closed = True | |
| thread = self._thread | |
| loop = self._loop | |
| if thread is None: | |
| return | |
| self._ready.wait() | |
| cleanup_error: Optional[BaseException] = None | |
| if loop is not None and not loop.is_closed(): | |
| try: | |
| if cleanup_factory is not None: | |
| cleanup = cleanup_factory() | |
| asyncio.run_coroutine_threadsafe(cleanup, loop).result( | |
| timeout=10 | |
| ) | |
| except BaseException as exc: | |
| # Even if provider cleanup fails or times out, the loop must | |
| # still be stopped. Otherwise the daemon thread and any | |
| # transport it owns survive until process exit. | |
| cleanup_error = exc | |
| finally: | |
| loop.call_soon_threadsafe(loop.stop) | |
| thread.join(timeout=10) | |
| if thread.is_alive(): | |
| close_error = RuntimeError( | |
| "Persistent asyncio runtime did not close cleanly." | |
| ) | |
| if cleanup_error is not None: | |
| close_error.__cause__ = cleanup_error | |
| raise close_error | |
| if cleanup_error is not None: | |
| raise cleanup_error | |
| def _ensure_started(self) -> None: | |
| with self._lock: | |
| if self._closed: | |
| raise RuntimeError("Persistent asyncio runtime is closed.") | |
| if self._thread is None: | |
| self._thread = threading.Thread( | |
| target=self._run_loop, | |
| name=self._thread_name, | |
| daemon=True, | |
| ) | |
| self._thread.start() | |
| self._ready.wait() | |
| if self._startup_error is not None: | |
| self.close() | |
| raise RuntimeError("Persistent asyncio runtime failed to start.") from ( | |
| self._startup_error | |
| ) | |
| def _run_loop(self) -> None: | |
| loop: Optional[asyncio.AbstractEventLoop] = None | |
| try: | |
| loop = asyncio.new_event_loop() | |
| asyncio.set_event_loop(loop) | |
| with self._lock: | |
| self._loop = loop | |
| self._ready.set() | |
| loop.run_forever() | |
| except BaseException as exc: | |
| self._startup_error = exc | |
| self._ready.set() | |
| raise | |
| finally: | |
| if loop is not None: | |
| pending = asyncio.all_tasks(loop) | |
| for task in pending: | |
| task.cancel() | |
| if pending: | |
| loop.run_until_complete( | |
| asyncio.gather(*pending, return_exceptions=True) | |
| ) | |
| loop.close() | |