A neural sequence-to-sequence model for controllable text style transfer, built with GRU-based encoder-decoder architecture. Given an input sentence, StyleNet rewrites it in a target style (e.g., formal to informal, factual to stylistic) while preserving the core meaning.
Text style transfer is the task of changing the style of a piece of text — its tone, formality, sentiment, or writing manner — while keeping the content the same. This is a challenging NLP problem that sits at the intersection of:
Input Sentence
|
[Encoder] — GRU-based bidirectional encoder
|
[Content Representation]
+
[Style Vector] — learned style embedding
|
[Decoder] — GRU-based autoregressive decoder
|
Output Sentence (in target style)
pip install torch numpy pandas tqdm
# Train the model
python train.py --data_path data/ --style formal --epochs 50
# Generate styled text
python generate.py --input "The weather is bad today." --target_style formal
# Output: "Today's meteorological conditions are unfavorable."
The model is evaluated on:
This implementation is inspired by:
Nishat Tasnim Mahi — AI/ML Researcher | NLP | Computer Vision | Multimodal Learning
740 commits
Python
100.0%
A neural sequence-to-sequence model for controllable text style transfer, built with GRU-based encoder-decoder architecture. Given an input sentence, StyleNet rewrites it in a target style (e.g., formal to informal, factual to stylistic) while preserving the core meaning.
Text style transfer is the task of changing the style of a piece of text — its tone, formality, sentiment, or writing manner — while keeping the content the same. This is a challenging NLP problem that sits at the intersection of:
Input Sentence
|
[Encoder] — GRU-based bidirectional encoder
|
[Content Representation]
+
[Style Vector] — learned style embedding
|
[Decoder] — GRU-based autoregressive decoder
|
Output Sentence (in target style)
pip install torch numpy pandas tqdm
# Train the model
python train.py --data_path data/ --style formal --epochs 50
# Generate styled text
python generate.py --input "The weather is bad today." --target_style formal
# Output: "Today's meteorological conditions are unfavorable."
The model is evaluated on:
This implementation is inspired by:
Nishat Tasnim Mahi — AI/ML Researcher | NLP | Computer Vision | Multimodal Learning
740 commits
Python
100.0%