Instructions to use ntworld6/alt-text-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ntworld6/alt-text-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ntworld6/alt-text-model")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("ntworld6/alt-text-model") model = AutoModelForMultimodalLM.from_pretrained("ntworld6/alt-text-model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ntworld6/alt-text-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ntworld6/alt-text-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ntworld6/alt-text-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ntworld6/alt-text-model
- SGLang
How to use ntworld6/alt-text-model 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 "ntworld6/alt-text-model" \ --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": "ntworld6/alt-text-model", "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 "ntworld6/alt-text-model" \ --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": "ntworld6/alt-text-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ntworld6/alt-text-model with Docker Model Runner:
docker model run hf.co/ntworld6/alt-text-model
End of training
Browse files- README.md +9 -6
- config.json +32 -4
- generation_config.json +20 -0
- model.safetensors +1 -1
- tokenizer.json +1 -1
- tokenizer_config.json +8 -2
- training_args.bin +1 -1
README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- generated_from_trainer
|
| 5 |
model-index:
|
|
@@ -12,9 +14,9 @@ should probably proofread and complete it, then remove this comment. -->
|
|
| 12 |
|
| 13 |
# alt-text-model
|
| 14 |
|
| 15 |
-
This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset.
|
| 16 |
It achieves the following results on the evaluation set:
|
| 17 |
-
- Loss:
|
| 18 |
|
| 19 |
## Model description
|
| 20 |
|
|
@@ -40,19 +42,20 @@ The following hyperparameters were used during training:
|
|
| 40 |
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 41 |
- lr_scheduler_type: linear
|
| 42 |
- num_epochs: 3
|
|
|
|
| 43 |
|
| 44 |
### Training results
|
| 45 |
|
| 46 |
| Training Loss | Epoch | Step | Validation Loss |
|
| 47 |
|:-------------:|:-----:|:----:|:---------------:|
|
| 48 |
-
|
|
| 49 |
-
|
|
| 50 |
-
|
|
| 51 |
|
| 52 |
|
| 53 |
### Framework versions
|
| 54 |
|
| 55 |
- Transformers 5.13.1
|
| 56 |
-
- Pytorch 2.11.0+
|
| 57 |
- Datasets 4.0.0
|
| 58 |
- Tokenizers 0.22.2
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
base_model: nlpconnect/vit-gpt2-image-captioning
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
| 7 |
model-index:
|
|
|
|
| 14 |
|
| 15 |
# alt-text-model
|
| 16 |
|
| 17 |
+
This model is a fine-tuned version of [nlpconnect/vit-gpt2-image-captioning](https://huggingface.co/nlpconnect/vit-gpt2-image-captioning) on an unknown dataset.
|
| 18 |
It achieves the following results on the evaluation set:
|
| 19 |
+
- Loss: 4.5740
|
| 20 |
|
| 21 |
## Model description
|
| 22 |
|
|
|
|
| 42 |
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 43 |
- lr_scheduler_type: linear
|
| 44 |
- num_epochs: 3
|
| 45 |
+
- mixed_precision_training: Native AMP
|
| 46 |
|
| 47 |
### Training results
|
| 48 |
|
| 49 |
| Training Loss | Epoch | Step | Validation Loss |
|
| 50 |
|:-------------:|:-----:|:----:|:---------------:|
|
| 51 |
+
| 4.6741 | 1.0 | 63 | 4.6086 |
|
| 52 |
+
| 3.8366 | 2.0 | 126 | 4.5547 |
|
| 53 |
+
| 3.5591 | 3.0 | 189 | 4.5740 |
|
| 54 |
|
| 55 |
|
| 56 |
### Framework versions
|
| 57 |
|
| 58 |
- Transformers 5.13.1
|
| 59 |
+
- Pytorch 2.11.0+cu128
|
| 60 |
- Datasets 4.0.0
|
| 61 |
- Tokenizers 0.22.2
|
config.json
CHANGED
|
@@ -2,8 +2,9 @@
|
|
| 2 |
"architectures": [
|
| 3 |
"VisionEncoderDecoderModel"
|
| 4 |
],
|
|
|
|
| 5 |
"decoder": {
|
| 6 |
-
"_name_or_path": "
|
| 7 |
"activation_function": "gelu_new",
|
| 8 |
"add_cross_attention": true,
|
| 9 |
"architectures": [
|
|
@@ -12,9 +13,12 @@
|
|
| 12 |
"attn_pdrop": 0.1,
|
| 13 |
"bos_token_id": 50256,
|
| 14 |
"chunk_size_feed_forward": 0,
|
|
|
|
|
|
|
| 15 |
"dtype": "float32",
|
| 16 |
"embd_pdrop": 0.1,
|
| 17 |
"eos_token_id": 50256,
|
|
|
|
| 18 |
"id2label": {
|
| 19 |
"0": "LABEL_0",
|
| 20 |
"1": "LABEL_1"
|
|
@@ -36,13 +40,16 @@
|
|
| 36 |
"n_positions": 1024,
|
| 37 |
"output_attentions": false,
|
| 38 |
"output_hidden_states": false,
|
| 39 |
-
"pad_token_id":
|
|
|
|
| 40 |
"problem_type": null,
|
|
|
|
| 41 |
"reorder_and_upcast_attn": false,
|
| 42 |
"resid_pdrop": 0.1,
|
| 43 |
"return_dict": true,
|
| 44 |
"scale_attn_by_inverse_layer_idx": false,
|
| 45 |
"scale_attn_weights": true,
|
|
|
|
| 46 |
"summary_activation": null,
|
| 47 |
"summary_first_dropout": 0.1,
|
| 48 |
"summary_proj_to_labels": true,
|
|
@@ -54,21 +61,31 @@
|
|
| 54 |
"max_length": 50
|
| 55 |
}
|
| 56 |
},
|
|
|
|
| 57 |
"tie_word_embeddings": true,
|
|
|
|
|
|
|
|
|
|
| 58 |
"use_cache": true,
|
| 59 |
"vocab_size": 50257
|
| 60 |
},
|
| 61 |
"decoder_start_token_id": 50256,
|
| 62 |
"dtype": "float32",
|
| 63 |
"encoder": {
|
| 64 |
-
"_name_or_path": "
|
|
|
|
| 65 |
"architectures": [
|
| 66 |
"ViTModel"
|
| 67 |
],
|
| 68 |
"attention_probs_dropout_prob": 0.0,
|
|
|
|
| 69 |
"chunk_size_feed_forward": 0,
|
|
|
|
|
|
|
| 70 |
"dtype": "float32",
|
| 71 |
"encoder_stride": 16,
|
|
|
|
|
|
|
| 72 |
"hidden_act": "gelu",
|
| 73 |
"hidden_dropout_prob": 0.0,
|
| 74 |
"hidden_size": 768,
|
|
@@ -79,6 +96,7 @@
|
|
| 79 |
"image_size": 224,
|
| 80 |
"initializer_range": 0.02,
|
| 81 |
"intermediate_size": 3072,
|
|
|
|
| 82 |
"is_encoder_decoder": false,
|
| 83 |
"label2id": {
|
| 84 |
"LABEL_0": 0,
|
|
@@ -91,12 +109,22 @@
|
|
| 91 |
"num_hidden_layers": 12,
|
| 92 |
"output_attentions": false,
|
| 93 |
"output_hidden_states": false,
|
|
|
|
| 94 |
"patch_size": 16,
|
| 95 |
"pooler_act": "tanh",
|
| 96 |
"pooler_output_size": 768,
|
|
|
|
| 97 |
"problem_type": null,
|
|
|
|
| 98 |
"qkv_bias": true,
|
| 99 |
-
"return_dict": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
},
|
| 101 |
"eos_token_id": 50256,
|
| 102 |
"is_encoder_decoder": true,
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"VisionEncoderDecoderModel"
|
| 4 |
],
|
| 5 |
+
"bos_token_id": 50256,
|
| 6 |
"decoder": {
|
| 7 |
+
"_name_or_path": "",
|
| 8 |
"activation_function": "gelu_new",
|
| 9 |
"add_cross_attention": true,
|
| 10 |
"architectures": [
|
|
|
|
| 13 |
"attn_pdrop": 0.1,
|
| 14 |
"bos_token_id": 50256,
|
| 15 |
"chunk_size_feed_forward": 0,
|
| 16 |
+
"cross_attention_hidden_size": null,
|
| 17 |
+
"decoder_start_token_id": 50256,
|
| 18 |
"dtype": "float32",
|
| 19 |
"embd_pdrop": 0.1,
|
| 20 |
"eos_token_id": 50256,
|
| 21 |
+
"finetuning_task": null,
|
| 22 |
"id2label": {
|
| 23 |
"0": "LABEL_0",
|
| 24 |
"1": "LABEL_1"
|
|
|
|
| 40 |
"n_positions": 1024,
|
| 41 |
"output_attentions": false,
|
| 42 |
"output_hidden_states": false,
|
| 43 |
+
"pad_token_id": 50256,
|
| 44 |
+
"prefix": null,
|
| 45 |
"problem_type": null,
|
| 46 |
+
"pruned_heads": {},
|
| 47 |
"reorder_and_upcast_attn": false,
|
| 48 |
"resid_pdrop": 0.1,
|
| 49 |
"return_dict": true,
|
| 50 |
"scale_attn_by_inverse_layer_idx": false,
|
| 51 |
"scale_attn_weights": true,
|
| 52 |
+
"sep_token_id": null,
|
| 53 |
"summary_activation": null,
|
| 54 |
"summary_first_dropout": 0.1,
|
| 55 |
"summary_proj_to_labels": true,
|
|
|
|
| 61 |
"max_length": 50
|
| 62 |
}
|
| 63 |
},
|
| 64 |
+
"tie_encoder_decoder": false,
|
| 65 |
"tie_word_embeddings": true,
|
| 66 |
+
"tokenizer_class": null,
|
| 67 |
+
"torchscript": false,
|
| 68 |
+
"use_bfloat16": false,
|
| 69 |
"use_cache": true,
|
| 70 |
"vocab_size": 50257
|
| 71 |
},
|
| 72 |
"decoder_start_token_id": 50256,
|
| 73 |
"dtype": "float32",
|
| 74 |
"encoder": {
|
| 75 |
+
"_name_or_path": "",
|
| 76 |
+
"add_cross_attention": false,
|
| 77 |
"architectures": [
|
| 78 |
"ViTModel"
|
| 79 |
],
|
| 80 |
"attention_probs_dropout_prob": 0.0,
|
| 81 |
+
"bos_token_id": null,
|
| 82 |
"chunk_size_feed_forward": 0,
|
| 83 |
+
"cross_attention_hidden_size": null,
|
| 84 |
+
"decoder_start_token_id": null,
|
| 85 |
"dtype": "float32",
|
| 86 |
"encoder_stride": 16,
|
| 87 |
+
"eos_token_id": null,
|
| 88 |
+
"finetuning_task": null,
|
| 89 |
"hidden_act": "gelu",
|
| 90 |
"hidden_dropout_prob": 0.0,
|
| 91 |
"hidden_size": 768,
|
|
|
|
| 96 |
"image_size": 224,
|
| 97 |
"initializer_range": 0.02,
|
| 98 |
"intermediate_size": 3072,
|
| 99 |
+
"is_decoder": false,
|
| 100 |
"is_encoder_decoder": false,
|
| 101 |
"label2id": {
|
| 102 |
"LABEL_0": 0,
|
|
|
|
| 109 |
"num_hidden_layers": 12,
|
| 110 |
"output_attentions": false,
|
| 111 |
"output_hidden_states": false,
|
| 112 |
+
"pad_token_id": null,
|
| 113 |
"patch_size": 16,
|
| 114 |
"pooler_act": "tanh",
|
| 115 |
"pooler_output_size": 768,
|
| 116 |
+
"prefix": null,
|
| 117 |
"problem_type": null,
|
| 118 |
+
"pruned_heads": {},
|
| 119 |
"qkv_bias": true,
|
| 120 |
+
"return_dict": true,
|
| 121 |
+
"sep_token_id": null,
|
| 122 |
+
"task_specific_params": null,
|
| 123 |
+
"tie_encoder_decoder": false,
|
| 124 |
+
"tie_word_embeddings": true,
|
| 125 |
+
"tokenizer_class": null,
|
| 126 |
+
"torchscript": false,
|
| 127 |
+
"use_bfloat16": false
|
| 128 |
},
|
| 129 |
"eos_token_id": 50256,
|
| 130 |
"is_encoder_decoder": true,
|
generation_config.json
CHANGED
|
@@ -1,9 +1,29 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 50256,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"eos_token_id": 50256,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"output_attentions": false,
|
| 6 |
"output_hidden_states": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"transformers_version": "5.13.1",
|
| 8 |
"use_cache": true
|
| 9 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 50256,
|
| 4 |
+
"decoder_start_token_id": 50256,
|
| 5 |
+
"diversity_penalty": 0.0,
|
| 6 |
+
"do_sample": false,
|
| 7 |
+
"early_stopping": false,
|
| 8 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 9 |
"eos_token_id": 50256,
|
| 10 |
+
"length_penalty": 1.0,
|
| 11 |
+
"max_length": 20,
|
| 12 |
+
"min_length": 0,
|
| 13 |
+
"no_repeat_ngram_size": 0,
|
| 14 |
+
"num_beam_groups": 1,
|
| 15 |
+
"num_beams": 1,
|
| 16 |
+
"num_return_sequences": 1,
|
| 17 |
"output_attentions": false,
|
| 18 |
"output_hidden_states": false,
|
| 19 |
+
"output_scores": false,
|
| 20 |
+
"pad_token_id": 50256,
|
| 21 |
+
"remove_invalid_values": false,
|
| 22 |
+
"repetition_penalty": 1.0,
|
| 23 |
+
"return_dict_in_generate": false,
|
| 24 |
+
"temperature": 1.0,
|
| 25 |
+
"top_k": 50,
|
| 26 |
+
"top_p": 1.0,
|
| 27 |
"transformers_version": "5.13.1",
|
| 28 |
"use_cache": true
|
| 29 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 956835520
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5558a1e199a8adaaa7117641c106ec2c2f2ac60ad57e1c24c1159ba58c511c08
|
| 3 |
size 956835520
|
tokenizer.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
"single_word": false,
|
| 24 |
"lstrip": false,
|
| 25 |
"rstrip": false,
|
| 26 |
-
"normalized":
|
| 27 |
"special": true
|
| 28 |
}
|
| 29 |
],
|
|
|
|
| 23 |
"single_word": false,
|
| 24 |
"lstrip": false,
|
| 25 |
"rstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
"special": true
|
| 28 |
}
|
| 29 |
],
|
tokenizer_config.json
CHANGED
|
@@ -3,11 +3,17 @@
|
|
| 3 |
"backend": "tokenizers",
|
| 4 |
"bos_token": "<|endoftext|>",
|
| 5 |
"eos_token": "<|endoftext|>",
|
| 6 |
-
"errors": "replace",
|
| 7 |
"is_local": false,
|
| 8 |
"local_files_only": false,
|
|
|
|
| 9 |
"model_max_length": 1024,
|
|
|
|
| 10 |
"pad_token": "<|endoftext|>",
|
| 11 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"unk_token": "<|endoftext|>"
|
| 13 |
}
|
|
|
|
| 3 |
"backend": "tokenizers",
|
| 4 |
"bos_token": "<|endoftext|>",
|
| 5 |
"eos_token": "<|endoftext|>",
|
|
|
|
| 6 |
"is_local": false,
|
| 7 |
"local_files_only": false,
|
| 8 |
+
"max_length": 32,
|
| 9 |
"model_max_length": 1024,
|
| 10 |
+
"pad_to_multiple_of": null,
|
| 11 |
"pad_token": "<|endoftext|>",
|
| 12 |
+
"pad_token_type_id": 0,
|
| 13 |
+
"padding_side": "right",
|
| 14 |
+
"stride": 0,
|
| 15 |
+
"tokenizer_class": "TokenizersBackend",
|
| 16 |
+
"truncation_side": "right",
|
| 17 |
+
"truncation_strategy": "longest_first",
|
| 18 |
"unk_token": "<|endoftext|>"
|
| 19 |
}
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5329
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5e5a13edf46872c5249a9fd5fb7cd96d3ed5b49fcae6faf3105e40d7213dd806
|
| 3 |
size 5329
|