Downloads · 30 days
80
4% of all-time downloads
ucsahin/TraVisionLM-base
TraVisionLM-base is a image-text-to-text model from ucsahin. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
<div style="text-align: center;" <img src="logo-white.png" alt="logo" style="width: 90%; height: auto;" </div
Downloads · 30 days
80
4% of all-time downloads
All-time downloads
2.2K
Public
Parameters
875M
3.5 GB on disk
Likes
27
Public
Click a slice to open those files.
.safetensors3.5 GB · 100%
From the Hugging Face model README
🌟 This is a very fast and small (only 875M parameters) visual language model on Hugging Face that responds to Turkish instructions given an image input! 🌟
✨ Developed compatible with the Transformers library, TRaVisionLM is a breeze to load, fine-tune, and use for lightning-fast inferences—all without needing any external libraries! ⚡️
Ready to experience the Turkish visual language model? Let's go! 🇹🇷🖼️🤖
🌟 Çok hızlı ve küçük boyutlu (sadece 875M parametre) Türkçe görsel dil modeli! Bir görüntü ve Türkçe talimat verildiğinde Türkçe yanıt üretir! 🌟
✨ Transformers kütüphanesi ile uyumlu olarak geliştirilen TraVisionLM modeli ile, yükleme, eğitme ve dış kütüphaneler kullanmadan hızlı sonuçlar almak çok kolay! ⚡️
Türkçe görsel dil modelini deneyimlemeye hazır mısınız? Hadi başlayalım! 🇹🇷🖼️🤖
This model is a multimodal large language model that combines SigLIP as its vision encoder with GPT2-large as its language model. The vision projector connects the two modalities together. Its architecture closely resembles PaliGemma, with some refined adjustments to the vision projector and the causal language modeling.
Here's the summary of the development process:
Bu model, SigLIP görsel kodlayıcısını ve GPT2-large dil modelini birleştiren çok modlu büyük bir dil modelidir. Görsel projektör, iki modaliteyi bir araya getirir. Mimarisi, PaliGemma ile yakından benzerlik gösterir, ancak görsel projektör ve neden-sonuç dil modellemesinde bazı uyarlamalar yapılmıştır.
Geliştirme sürecinin özeti:
Below are the scenarios where the TraVisionLM visual language model can be used directly or indirectly for various tasks. Also, don't forget to check out the section on out-of-scope uses.
You can give the model task instructions like "Açıkla", "Kısaca açıkla", "Görseli özetle", "Çok kısa özetle" etc., for this task. The model will generate a short description of the image you provide. Below, the usage code with the Transformer library is shared.
Important reminder: The model tends to hallucinate less for this task. You can try adjusting the generation parameters to produce the most useful answer for your needs.
You can give the model task instructions like "Detaylı açıkla", "Çok detaylı açıkla", "Görseli detaylı anlat", "Görseli çok detaylı anlat" etc., for this task. The model will generate a very detailed description of the image you provide.
Important reminder: The model tends to hallucinate more for this task. Although it generally produces responses related to the image, it may provide details and information that are not present in the image. You can try adjusting the generation parameters to produce the most useful answer for your needs.
You can ask the model open-ended questions like "Resmin odağında ne var?", "Görselde adam ne yapıyor?", "Kaç zürafa var?", "Görselle ilgili ne söylenir?", "Görseldeki *obje* ne renk?" etc., for this task. The model will generate responses that complement your question.
Important reminder: The model tends to hallucinate more for this task. Although it generally produces responses related to the image and the question, it may provide details and information that are not present in the image. You can try adjusting the generation parameters to produce the most useful answer for your needs.
As time permits, I plan to share more applications for these indirect uses. Meanwhile, I eagerly await support or collaboration requests from the community 🤝💪
This model is not suitable for the following scenarios:
Aşağıda TraVisionLM görsel dil modelinin, hangi görevler için doğrudan ve dolaylı kullanılabileceği durumlar verilmiştir. Ayrıca alan dışı kullanımlar kısmına da göz atmayı unutmayın.
Bu görev için modele "Açıkla", "Kısaca açıkla", "Görseli özetle", "Çok kısa özetle" ve benzeri görev talimatları verebilirsiniz. Model verdiğiniz resmin kısa bir açıklamasını yapacaktır. Aşağıda modelin Transformer kütüphanesiyle kullanım kodları paylaşılmıştır.
Önemli hatırlatma: Model bu görev için daha az halüsinasyon görmektedir. Kullanırken üretim parametrelerini değiştirerek işinize en çok yarayacak cevabı ürettirmeyi deneyebilirsiniz.
Bu görev için modele "Detaylı açıkla", "Çok detaylı açıkla", "Görseli detaylı anlat", "Görseli çok detaylı anlat" ve benzeri görev talimatları verebilirsiniz. Model verdiğiniz resmin çok detaylı bir açıklamasını yapacaktır. Aşağıda modelin Transformer kütüphanesiyle kullanım kodları paylaşılmıştır.
Önemli hatırlatma: Model bu görev için genellikle fazla halüsinasyon görmektedir. Genel olarak resimle alakalı cevaplar üretse de, resimde olmayan detaylar ve bilgiler verebilmektedir. Kullanırken üretim parametrelerini değiştirerek işinize en çok yarayacak cevabı ürettirmeyi deneyebilirsiniz.
Bu görev için modele "Resmin odağında ne var?", "Görselde adam ne yapıyor?", "Kaç zürafa var?", "Görselle ilgili ne söylenir?", "Görseldeki *obje* ne renk?" ve benzeri ucu açık sorular sorabilirsiniz. Model sorunuzu tamamlayacak cevaplar üretecektir. Aşağıda modelin Transformer kütüphanesiyle kullanım kodları paylaşılmıştır.
Önemli hatırlatma: Model bu görev için genellikle fazla halüsinasyon görebilmektedir. Genel olarak resimle ve sorulan soruyla alakalı cevaplar üretse de, resimde olmayan detaylar ve bilgiler verebilmektedir. Kullanırken üretim parametrelerini değiştirerek işinize en çok yarayacak cevabı ürettirmeyi deneyebilirsiniz.
Zaman buldukça bu dolaylı kullanım uygulamaları ile paylaşımlar yapmayı planlıyorum. Bu sürede topluluktan da destek ya da işbirliği isteklerini dört gözle bekliyorum 🤝💪
Bu modelin aşağıdaki senaryolar için kullanımı uygun değildir:
In Transformers, you can load the model and do inference as follows:
IMPORTANT NOTE: TraVisionLM model is not yet integrated natively into the Transformers library. So you need to set trust_remote_code=True when loading the model. It will download the configuration_travisionlm.py, modeling_travisionlm.py and processing_travisionlm.py files from the repo. You can check out the content of these files under the Files and Versions tab and pin the specific versions if you have any concerns regarding malicious code.
from transformers import AutoModelForCausalLM, AutoProcessor
import torch
import requests
from PIL import Image
model = AutoModelForCausalLM.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True, device_map="cuda")
# you can also load the model in bfloat16 or float16
# model = AutoModelForCausalLM.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True, torch_dtype=torch.bfloat16, device_map="cuda")
processor = AutoProcessor.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True)
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
prompt = "Açıkla" # short caption
# prompt = "Detaylı açıkla" # detailed caption
# prompt = "Araba ne renktir?" # visual qa
# prompt = "Resmin odak noktası nedir?" # visual qa
# prompt = "Araba nerede duruyor?" # visual qa
inputs = processor(text=prompt, images=image, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.6, top_p=0.9, top_k=50, repetition_penalty=1.2)
output_text = processor.batch_decode(outputs, skip_special_tokens=True)[0]
print("Model response: ", output_text)
You can also perform batch inference as follows (make sure that all images have a prompt text associated with them):
from transformers import AutoModelForCausalLM, AutoProcessor
import torch
import requests
from PIL import Image
model = AutoModelForCausalLM.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True, device_map="cuda")
# you can also load the model in bfloat16 or float16
# model = AutoModelForCausalLM.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True, torch_dtype=torch.bfloat16, device_map="cuda")
processor = AutoProcessor.from_pretrained('ucsahin/TraVisionLM-base', trust_remote_code=True)
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
prompt_list = [
'Açıkla',
'Detaylı açıkla',
'Araba nerede duruyor?',
'Arabanın rengi nedir?',
]
inputs = processor(text=prompt_list, images=len(prompt_list)*[image], padding="longest", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.6, top_p=0.9, top_k=50, repetition_penalty=1.2)
output_text_list = processor.batch_decode(outputs, skip_special_tokens=True)
for output_text in output_text_list:
print(f"Model response: {output_text}\n\n\n")
The output will look like this:
"""
Model response: Açıkla
Bir binanın önünde, sokakta park halindeki mavi bir Volkswagen Beetle.
Model response: Detaylı açıkla
Bu görüntüde, bir taş döşeli sokakta park edilmiş yeşil ve mavi bir Volkswagen Beetle bulunmaktadır. Arka planda iki sarı bina vardır. Araba kameraya doğru bakmaktadır. Görüntü net odaklanmıştır ve renkler canlıdır. Görsel tarzı gerçekçidir.
Model response: Araba nerede duruyor?
Araba, sarı bir binanın yanında sokakta park edilmiş.
Model response: Arabanın rengi nedir?
Araba turkuaz veya limon yeşili renktedir.
"""
First off, thank you for your interest if you're planning to use this model. I developed it to demonstrate that you can create your own multimodal transformer-based model in a low-resource language like Turkish using only the open-source tools available in the Hugging Face ecosystem. This task would have been nearly impossible without such a platform that supports open-source research and community, so I owe a big thanks 🙏🙏.
As for the model itself, it’s not as powerful as the VLM models developed by companies like Google, Microsoft, or Meta AI.
I worked alone in an environment with limited access to high-quality, diverse multimodal Turkish data. My computing resources were also limited, relying mainly on cloud GPU providers like Colab and Runpod.
So, why create a Turkish Vision Language Model?
My answer is simple, and I’ll break it down into three points:
In closing, I hope this model makes a valuable contribution to the open-source Turkish community, and I welcome all your feedback 🤘🤘.
Öncelikle, bu modeli kullanmayı düşünüyorsanız ilginiz için teşekkür ederim. Bu modeli, Hugging Face ekosisteminde mevcut olan açık kaynak araçları kullanarak, düşük kaynaklı bir dilde (Türkçe gibi) kendi çok modlu transformer tabanlı modelinizi oluşturabileceğinizi göstermek amacıyla geliştirdim. Böyle bir platform olmasaydı, bu iş neredeyse imkansız olurdu, bu yüzden büyük bir teşekkür borçluyum 🙏🙏.
Modelin kendisine gelince, Google, Microsoft veya Meta AI gibi büyük şirketlerin geliştirdiği VLM modelleri kadar güçlü değil.
Modeli geliştirirken, GPU kaynaklarının ve kaliteli, çeşitli çok modlu Türkçe veriye erişimin sınırlı olduğu bir ortamda çalıştım.
Peki, neden Türkçe bir Görsel Dil Modeli geliştirmek gerekiyor?
Cevabım basit, ve bunu üç madde ile açıklamak istiyorum:
Daha fazla uzatmadan, bu modelin açık kaynak Türkçe topluluğuna iyi bir katkı sağlayacağını umuyorum ve tüm geri bildirimlerinizi bekliyorum 🤘🤘.
Bu kısımda benim de daha önce rast geldiğim bu alandaki birkaç çalışmaya kredi vermek istiyorum. Unuttuklarım varsa, haber vermeniz halinde eklenecektir.
I plan to release the multimodal Turkish data used during the training of the model. But, the data in its current format is not ready for publication.
Until then, in order to provide some details regarding the dataset and to contribute to the open-source community, I am releasing the evaluation portion of the dataset at ucsahin/Turkish-VLM-Mix-Benchmark.
The dataset consists of predominantly translated versions of the well-known multimodal datasets from English to Turkish. More information on this will be shared in the future.
The following training hyperparameters are used in feature alignment and task specific training stages respectively:
| Data size | Global Batch Size | Learning Rate | Epochs | Max Length | Weight Decay |
|---|---|---|---|---|---|
| 500K | 128 | 1e-3 | 1 | 1024 | 0 |
| Data size | Global Batch Size | Learning Rate | Epochs | Max Length | Weight Decay |
|---|---|---|---|---|---|
| 1.1M | 128 | 2e-5 | 3 | 1024 | 0 |
This section will be updated after I get some evaluation results on the ucsahin/Turkish-VLM-Mix-Benchmark.
More on this later...
The following compute resources are used in feature alignment and task specific training stages respectively:
1xA100(40GB), took approximately 4 GPU hours.
1xH100(80GB), took approximately 18 GPU hours.
I am releasing TraVisionLM under the Apache 2.0 License. To the best of my knowledge after through research, this should comply with the datasets and unimodal vision and language models used during development.
However, if I receive any notification indicating otherwise, I will promptly update the licensing information as needed.
If you use the TraVisionLM model in your research, work, or personal projects, please acknowledge this repository. 🙏
Finally, I may plan to publish this work in an academic setting if it reaches a mature state. In that case, I will provide the appropriate citations here so that any future work can appropriately cite it.
If you have questions or suggestions regarding the model, I prefer if you would reach me directly via Hugging Face (e.g. opening an issue). But if you have specific things in your mind or any ideas for collaboration on future projects, reach me at sahin.umitcan@gmail.com
Modelle ilgili sorularınız veya önerileriniz varsa, doğrudan bana Hugging Face üzerinden (örneğin, bir issue açarak) ulaşmanızı tercih ederim. Diğer konular veya gelecekteki projelerde işbirliği için herhangi bir fikriniz varsa, bana sahin.umitcan@gmail.com adresinden ulaşabilirsiniz.