Downloads · 30 days
8
5% of all-time downloads
Bajiyo/ml-en-transliteration
ml-en-transliteration is a machine learning model from Bajiyo. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for tf-keras.
This repository contains a model for transliterating Malayalam names to English names using LSTM and Attention mechanisms.
Downloads · 30 days
8
5% of all-time downloads
All-time downloads
171
Public
Repo size
5 MB
Likes
1
Public
Click a slice to open those files.
.data-00000-of-000012.8 MB · 56%
From the Hugging Face model README
This repository contains a model for transliterating Malayalam names to English names using LSTM and Attention mechanisms.
The dataset used for training this model is a subset of the Santhosh's English-Malayalam Names dataset. Only a small subset of the large dataset was used for training.
The code for training and testing the model, along with the subset of the dataset used, is available in the following GitHub repository:
You can run and use the train and test datasets from this GitHub link. The dataset is located in a folder called dataset.
saved_model.pb: The trained model saved in TensorFlow's SavedModel format.source_tokenizer.json: Tokenizer for Malayalam text.target_tokenizer.json: Tokenizer for English text.variables.data-00000-of-00001: Model variables.variables.index: Index for model variables.The model architecture consists of the following components:
The model achieved the following performance on the test set:
753To use the model for transliteration:
import tensorflow as tf
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import json
# Function to convert sequences back to strings
def sequence_to_text(sequence, tokenizer):
reverse_word_map = dict(map(reversed, tokenizer.word_index.items()))
text = ''.join([reverse_word_map.get(i, '') for i in sequence])
return text
# Load the model
model = tf.keras.models.load_model('path_to_your_model_directory')
# Load tokenizers
with open('source_tokenizer.json') as f:
source_tokenizer_data = json.load(f)
source_tokenizer = tf.keras.preprocessing.text.tokenizer_from_json(source_tokenizer_data)
with open('target_tokenizer.json') as f:
target_tokenizer_data = json.load(f)
target_tokenizer = tf.keras.preprocessing.text.tokenizer_from_json(target_tokenizer_data)
# Prepare the input text
input_text = "your_input_text"
input_sequence = source_tokenizer.texts_to_sequences([input_text])
input_padded = pad_sequences(input_sequence, maxlen=100, padding='post') # Adjust maxlen if needed
# Get the prediction
prediction = model.predict(input_padded)
predicted_sequence = np.argmax(prediction, axis=-1)[0]
predicted_text = sequence_to_text(predicted_sequence, target_tokenizer)
print("Transliterated Text:", predicted_text)
---
license: other
license_name: other
license_link: LICENSE
---