Stas Bekman, a key contributor to the open-source AI community, recently documented the intricate process of porting Facebook FAIR’s high-performance WMT19 translation system into the Hugging Face transformers library. This wasn’t just a simple copy-paste job. It required bridging two distinct architectural ecosystems. Bekman started with English-Russian and Russian-English models because he speaks both languages. This choice allowed him to manually verify translation quality during development, a crucial step that would have been impossible with German-English pairs without native fluency.
The technical hurdle was significant. The en-ru models used two separate vocabularies of different sizes, while the de-en models relied on a merged vocabulary. By tackling the harder dual-vocabulary problem first, Bekman found that supporting the merged vocabulary became trivial later on. He didn’t start from scratch, either. He initially wrote a proxy notebook to emulate the transformers API using fairseq under the hood. This “cheat” provided immediate functionality but lacked the deep integration needed for broader adoption. The real work involved creating new files like configuration_fsmt.py and modeling_fsmt.py, effectively building a new model class within the library.
A critical component was the conversion script, convert_fsmt_original_pytorch_checkpoint_to_pytorch.py. Bekman adapted this from an existing BART conversion script, gutting it and rebuilding it to handle fairseq’s specific checkpoint structures, dictionaries, and tokenizer support files. He tested against local copies of converted models before uploading to Hugging Face’s S3 bucket. This meticulous approach ensures that developers can now access these state-of-the-art translation weights directly through the transformers pipeline. It removes the friction of maintaining separate fairseq installations for inference.
This port highlights a growing trend in AI infrastructure: the consolidation of models into unified frameworks. While fairseq remains powerful for training, transformers has become the de facto standard for deployment and interoperability. By moving these weights, Bekman has made Facebook’s research more accessible to engineers who don’t want to manage multiple deep learning libraries. It also sets a precedent for how other legacy or framework-specific models can be migrated. The next challenge will be maintaining parity as both libraries evolve, but for now, the bridge is built.