Skip to content

Latest commit

 

History

History
145 lines (110 loc) · 6.1 KB

README.md

File metadata and controls

145 lines (110 loc) · 6.1 KB

DCG-DemoApp

The DCG Demo App is an application which is a frontend and server for the showcasing of the Domainlifecycles Code Generator (DCG) model which was developed as part of my master thesis at esentri. This repository is a decoupling from the main repository DomainlifecyclesCodeGenerator in which the entire development of the model is documented.

Overview

This repository contains a basic PyQT app with a flask server to run the fine-tuned DCG model, showcasing the code generation.

DCG-DemoApp
├──images
│   ├── DCGAppUIUsage.png
│   └── e-mit-stern-grün.svg
├──models
│   └──finalTraining_v1
│   │   ├── adapter_config.json
│   │   ├── adapter_model.safetensors
│   │   ├── generation_config.json
│   │   └── training_args.bin
├── DCG_Client.py
├── DCG_Server.py
├── README.md
└── environment.yml

Installation and Setup

This application consists of two parts: DCG_Client.py and DCG_Server.py. Follow the steps below to get started.

1. Setting Up DCG_Server

Important

The Server should run on a Linux 64 bit system with a NVIDIA graphics card. The Setup was tested and engineered on Ubuntu 22.04.4 LTS with a GeForce RTX 2080 Ti.

  1. Clone the Repository

    On your Nvidia GPU PC or Server Host, clone the repository:

    git clone [email protected]:Tr33Bug/DCG-DemoApp.git
    cd DCG-DemoApp
  2. Install the Requirements

    Create a conda environment and install all the requirements from the environment.yml:

    # create environment
    conda env create -f environment.yml
    
    # activate environment
    conda activate DCGServerEnv
  3. Start the Server

    Run the server application:

    python DCG_Server.py

    You will be prompted with the host IP once the server is up and running.

2. Setting Up DCG_Client

  1. Clone the Repository

    On your client device, clone the repository:

    git clone [email protected]:Tr33Bug/DCG-DemoApp.git
    cd DCG-DemoApp
  2. Install the Requirements

    Install the necessary Python packages:

    pip install PyQt5
  3. Server IP Setting

    For better convenience, change the url in DCG_Client.py in Line 15 to your own Server IP or when running it on the same device, use localhost 127.0.0.1:5000/chat instead.

    • Default Port is 5000
    • API endpoint is /chat
  4. Start the Client

    Run the client application:

    python DCG_Client.py

Now, you should have the DCG_Server running on your server host and the DCG_Client running on your client device, ready for use.

Usage

UI-WithAnnotations

  1. Server Settings:
    • In this text field you must enter the IP address with the port and the /chat as the interface on which the server is running.
    • If the server and client are running on the same host, 127.0.0.1 can be used here.
  2. Prompt Input:
    • The prompt for the DCG is entered in this text field.
    • The DCG is trained on next token generation and therefore the prompt is the start of the generated JSON object.
    • Best practice for generation is to begin the prompt with , as this token was also used as the start token during training.
    • It is also advisable to specify the entire class to be generated in order to increase the quality of the generated JSON objects.
    • Example prompts for all different domain lifecycle objects formally NitroX objects:
      • EntityModel: <START> { "@class" : "nitrox.dlc.mirror.model.EntityModel"
      • ValueObjectModel: <START> { "@class" : "nitrox.dlc.mirror.model.ValueObjectModel"
      • AggregateRootModel: <START> { "@class" : "nitrox.dlc.mirror.model.AggregateRootModel"
      • IdentityModel: <START> { "@class" : "nitrox.dlc.mirror.model.IdentityModel"
      • EnumModel: <START> { "@class" : "nitrox.dlc.mirror.model.EnumModel"
      • DomainServiceModel: <START> { "@class" : "nitrox.dlc.mirror.model.DomainServiceModel"
      • RepositoryModel: <START> { "@class" : "nitrox.dlc.mirror.model.RepositoryModel"
      • ApplicationServiceModel: <START> { "@class" : "nitrox.dlc.mirror.model.ApplicationServiceModel"
      • DomainEventModel: <START> { "@class" : "nitrox.dlc.mirror.model.DomainEventModel"
      • DomainCommandModel: <START> { "@class" : "nitrox.dlc.mirror.model.DomainCommandModel"
  3. Settings:
    • Timeout sets the time the client waits for the server to respond.
    • Post-Processing describes the closing and cleaning up of the JSON objects. (See postprocessing() function in DSG_Client.py line 17.)
    • With JSON Format the generated JSON is parsed. If parsing is successful, the JSON is formatted and displayed in the output window. If errors occur, the raw generated JSON is displayed with the corresponding error in the output window.
    • JSON generation is started with the Generate! button. This sends a POST request to the server.
  4. Output Window:
    • In the output window, the prompt and the DCG output are displayed in a chat history design.
    • The history is deleted when the app is restarted.

Contributing

This project is not being actively developed further. The demo application was only used to demonstrate the results of my master thesis and the Domainlifecycles Code Generator (DCG), formally NitroX Code Generator (NCG).

For questions or suggestions please open an issue.

Acknowledgements

License

This project is licensed under the MIT License - see the LICENSE file for details.