Views
No views yet
khmer-nltk for Khmer word segmentation.phonsobon/khmer_images_captioning_v2.transformers model — it uses custom PyTorch code (modeling_khmer_captioning.py
in this repo) rather than AutoModel.config.json — architecture hyperparametersdecoder.pt — trained decoder weights (state_dict)vocab.json — word-level vocabulary (itos list)modeling_khmer_captioning.py — model classes + load_model() / caption_image() helperstorchvision when you load the model.pip install torch torchvision pillow huggingface_hub1from huggingface_hub import snapshot_download
2import sys
3
4repo_dir = snapshot_download("phonsobon/khmer-images_captioning")
5sys.path.insert(0, repo_dir)
6
7from modeling_khmer_captioning import load_model, caption_image
8
9encoder, decoder, itos, stoi, cfg = load_model(repo_dir)
10caption = caption_image("your_image.jpg", encoder, decoder, itos, stoi, cfg, beam_size=3)
11print(caption)khmer-nltk, whose
probabilistic tokenizer won't always agree exactly with human segmentation, which affects
BLEU-style evaluation more than it affects readability.