Instructions to use tonyassi/git-base-luc1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tonyassi/git-base-luc1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tonyassi/git-base-luc1")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("tonyassi/git-base-luc1") model = AutoModelForImageTextToText.from_pretrained("tonyassi/git-base-luc1") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use tonyassi/git-base-luc1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tonyassi/git-base-luc1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tonyassi/git-base-luc1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tonyassi/git-base-luc1
- SGLang
How to use tonyassi/git-base-luc1 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 "tonyassi/git-base-luc1" \ --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": "tonyassi/git-base-luc1", "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 "tonyassi/git-base-luc1" \ --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": "tonyassi/git-base-luc1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tonyassi/git-base-luc1 with Docker Model Runner:
docker model run hf.co/tonyassi/git-base-luc1
Update README.md
Browse files
README.md
CHANGED
|
@@ -23,6 +23,33 @@ It achieves the following results on the evaluation set:
|
|
| 23 |
|
| 24 |
More information needed
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
## Intended uses & limitations
|
| 27 |
|
| 28 |
More information needed
|
|
|
|
| 23 |
|
| 24 |
More information needed
|
| 25 |
|
| 26 |
+
## Usage
|
| 27 |
+
```python
|
| 28 |
+
import torch
|
| 29 |
+
from PIL import Image
|
| 30 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 31 |
+
import requests
|
| 32 |
+
|
| 33 |
+
# Load model directly
|
| 34 |
+
processor = AutoProcessor.from_pretrained("tonyassi/git-base-lucy1")
|
| 35 |
+
model = AutoModelForCausalLM.from_pretrained("tonyassi/git-base-lucy1")
|
| 36 |
+
|
| 37 |
+
# Load image
|
| 38 |
+
url = "https://datasets-server.huggingface.co/cached-assets/tonyassi/lucy-caption-2/--/94d2ffc965a7a0a50beebbeb60d04fa38a24ff66/--/default/train/6/image/image.jpg?Expires=1727109954&Signature=IMpoIBQV-ICPaC8V4NF2SUn0OQE7cOtIJZIeGSpOQLifkjlXl3rx6CAukc2Ax3Gkl4eQ3BfcDrnV2HNzE-c3c5WC5lcj30PWTkSczcqN7YtkKGFHOxlS6-Gv8zotQw8NJPn0d-LoCERHlxA75Sbh8vF8X6DE1SCRJIitT3DFcObTdKpZpHYDv21BYq4-A4EN04wX6aKHWyz8xR0NorlOtcB8dzPdsSpRGy3gcgLU9kHeBNWpa22KsMDJmDP8QferzrnG5bnb5fi9RxrMCTURCPUB8AyNJ1mVwuAorW4GJIdm40UEoqanQzrST3hIp-dTEH47w5-GY5PnOrWUcaxYGQ__&Key-Pair-Id=K3EI6M078Z3AC3"
|
| 39 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 40 |
+
|
| 41 |
+
# GPU or CPU
|
| 42 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 43 |
+
|
| 44 |
+
# Inference
|
| 45 |
+
inputs = processor(images=image, return_tensors="pt").to(device)
|
| 46 |
+
pixel_values = inputs.pixel_values
|
| 47 |
+
generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
|
| 48 |
+
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 49 |
+
print(generated_caption)
|
| 50 |
+
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
## Intended uses & limitations
|
| 54 |
|
| 55 |
More information needed
|