Instructions to use workwithHasnain/image-caption-generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use workwithHasnain/image-caption-generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="workwithHasnain/image-caption-generator")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("workwithHasnain/image-caption-generator") model = AutoModelForMultimodalLM.from_pretrained("workwithHasnain/image-caption-generator", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use workwithHasnain/image-caption-generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "workwithHasnain/image-caption-generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "workwithHasnain/image-caption-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/workwithHasnain/image-caption-generator
- SGLang
How to use workwithHasnain/image-caption-generator 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 "workwithHasnain/image-caption-generator" \ --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": "workwithHasnain/image-caption-generator", "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 "workwithHasnain/image-caption-generator" \ --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": "workwithHasnain/image-caption-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use workwithHasnain/image-caption-generator with Docker Model Runner:
docker model run hf.co/workwithHasnain/image-caption-generator
| tags: | |
| - generated_from_trainer | |
| model-index: | |
| - name: image-caption-generator | |
| results: [] | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # image-caption-generator | |
| This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset. | |
| It achieves the following results on the evaluation set: | |
| - Loss: 0.2180 | |
| ## Model description | |
| More information needed | |
| ## Intended uses & limitations | |
| More information needed | |
| ## Training and evaluation data | |
| More information needed | |
| ## Training procedure | |
| ### Training hyperparameters | |
| The following hyperparameters were used during training: | |
| - learning_rate: 5e-05 | |
| - train_batch_size: 32 | |
| - eval_batch_size: 32 | |
| - seed: 42 | |
| - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 | |
| - lr_scheduler_type: linear | |
| - num_epochs: 18 | |
| ### Training results | |
| | Training Loss | Epoch | Step | Validation Loss | | |
| |:-------------:|:-----:|:----:|:---------------:| | |
| | No log | 1.0 | 140 | 0.9561 | | |
| | No log | 2.0 | 280 | 0.8228 | | |
| | No log | 3.0 | 420 | 0.7362 | | |
| | 1.0135 | 4.0 | 560 | 0.6639 | | |
| | 1.0135 | 5.0 | 700 | 0.5998 | | |
| | 1.0135 | 6.0 | 840 | 0.5435 | | |
| | 1.0135 | 7.0 | 980 | 0.4893 | | |
| | 0.6775 | 8.0 | 1120 | 0.4445 | | |
| | 0.6775 | 9.0 | 1260 | 0.4032 | | |
| | 0.6775 | 10.0 | 1400 | 0.3637 | | |
| | 0.5059 | 11.0 | 1540 | 0.3269 | | |
| | 0.5059 | 12.0 | 1680 | 0.3013 | | |
| | 0.5059 | 13.0 | 1820 | 0.2749 | | |
| | 0.5059 | 14.0 | 1960 | 0.2553 | | |
| | 0.389 | 15.0 | 2100 | 0.2395 | | |
| | 0.389 | 16.0 | 2240 | 0.2280 | | |
| | 0.389 | 17.0 | 2380 | 0.2214 | | |
| | 0.3218 | 18.0 | 2520 | 0.2180 | | |
| ### Framework versions | |
| - Transformers 4.39.3 | |
| - Pytorch 2.1.2 | |
| - Datasets 2.18.0 | |
| - Tokenizers 0.15.2 | |