Downloads · 30 days
0
Nishat5349/machine_translation_english_to_french
machine_translation_english_to_french is a machine learning model from Nishat5349. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Machine Translation, the process of automatically translating text from one language to another, has become an essential tool in today's globalized world. In this project, we focus on the task of translating English t…
Downloads · 30 days
0
Access
Public
Updated Apr 9, 2024
Repo size
7.9 MB
Likes
0
Public
Click a slice to open those files.
.zip7.9 MB · 91%
From the Hugging Face model README
Machine Translation, the process of automatically translating text from one language to another, has become an essential tool in today's globalized world. In this project, we focus on the task of translating English text into French using advanced machine learning techniques. By harnessing the power of Neural Machine Translation (NMT) models, we aim to bridge linguistic barriers and facilitate seamless communication across languages.
To train our English-to-French translation model, we collected the dataset from "https://www.manythings.org/anki/". This dataset comprises pairs of English sentences and their corresponding French translations. By leveraging this comprehensive dataset, we ensure that our model learns to accurately capture the nuances and intricacies of both languages, enabling high-quality translations.
Make sure to have the required dependencies installed. You can install them using pip:
pip install numpy keras matplotlib
The model architecture consists of an Encoder-Decoder LSTM network with an embedding layer.Our machine translation model is built upon state-of-the-art Neural Machine Translation (NMT) architecture. It employs a sequence-to-sequence (Seq2Seq) framework with attention mechanisms, allowing the model to effectively encode input English sentences and generate corresponding French translations. The architecture consists of encoder and decoder components, each comprising multiple layers of recurrent or transformer neural networks. Through extensive training on the collected dataset, our model learns to generate fluent and contextually accurate translations, offering a powerful tool for cross-lingual communication. The model utilizes a Long Short-Term Memory (LSTM) network architecture implemented using Keras. Below is a brief overview of the model:

In this project, we utilize GloVe word embeddings for English sentences (inputs) and custom word embeddings for translated French sentences (outputs). GloVe embeddings provide a pre-trained set of word vectors, while custom embeddings are trained specifically for our task. In the model architecture, the input placeholder for the encoder (input_1) is embedded and passed through the encoder LSTM (lstm_1), generating outputs including the hidden layer and cell state. These states are then passed to the decoder LSTM (lstm_2) along with the output sentences tokenized at the start (input_2). The decoder LSTM processes the input and generates predictions, which are passed through a dense layer to produce the final output.
We train the model using the provided input and output sequences along with their corresponding targets. An early stopping callback is employed to prevent overfitting by monitoring validation loss. The model is trained over 8 epochs with a batch size of 64 and a validation split of 20%.
# Compile the model
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
# Train the model
history = model.fit([encoder_inputs, decoder_inputs], decoder_targets,
batch_size=64,
epochs=8,
validation_split=0.2)
A graph illustrating the training and validation loss and accuracy is generated during the training process, providing insights into the model's performance and convergence.


NISHAT TASNIM ([email protected])
This project is licensed under the MIT License - see the LICENSE file for details.