Machine Translation
摘要
This chapter focuses on machine translation (MT) using the Transformer model. It introduces the history and applications of MT, detailing the implementation of a Chinese-to-English translation method based on the Transformer framework. The chapter explains the entire process, including data processing (loading, tokenization, converting data to feature form), model construction (embedding layers, encoder, decoder), training configuration (optimizer, loss function, evaluation metrics), and model evaluation. It also provides code examples for each step and analyzes key concepts like positional encoding, label smoothing, and the Adam optimizer with the Noam learning rate decay schedule. The chapter concludes by demonstrating model prediction with sample Chinese texts and provides exercises for further learning.