Skip to content

Configuration

Step 1. Configure CodeTransEngine

Configuring InterTrans can be done through the .yaml configuration file. Additionally, you need to specify the paths to the container images for the target languages you want to translate to. This guide will walk you through the steps to configure InterTrans.

Step 2. Download Executor Images

InterTrans uses Singularity containers to execute the translated code. These images contains dependencies for common benchmarks in code translation (CodeNet, HumanEval-X and TransCoder). The containers have an entrypoint script that executes the code and returns the output (or error) to the CodeTransEngine. You would need to use a container for each target language you have in your translation (e.g., if doing Python to Java translation, you would need the Java container image). We recommend that you create your own executor image for your specific use case, as you would be able to include dependencies. Please find more information in the development section of the documentation.

  1. Download the container images for the languages you want to translate to:

    LanguageDownload LinkAuthor
    ☕ JavaDownload Java .sifInterTrans Authors
    🐍 PythonDownload Python .sifInterTrans Authors
    🐹 GoDownload Go .sifInterTrans Authors
    💻 C#Download C# .sifInterTrans Authors
    CDownload C/C++ .sifInterTrans Authors
    C++Download C/C++ .sifInterTrans Authors
    🦀 RustDownload Rust .sifInterTrans Authors
    🌐 JavaScriptDownload JavaScript .sifInterTrans Authors
  2. Place the container images in a directory accessible by the CodeTransEngine. You can specify the directory for each executor image in the configuration file.

  3. Update the configuration file with the paths to the container images. For example, if you were to add Python and Java executors, your configuration file could look like this:

    executionContainers:
    "Python": "./singularity/img/python3.sif"
    "Java": "./singularity/img/java.sif"

    You can find more information on the configuration file in the Server Configuration guide.

Most of our execution containers are based on the great work of esolang-box. You can use their containers as base images for your own executor images. We made slight modifications to the entrypoint script to make it compatible with the CodeTransEngine. You can find the source code for the containers inside the docker folder InterTrans GitHub repo.

Run the server

To run the server, you can do a Go build or run the program directly following this command:

Terminal window
go intertrans.go runserver config.yaml

The server will start with the configuration file you have provided and listen at the gRPC address. You can now start sending requests to the server.