Skip to content

Latest commit

 

History

History
161 lines (98 loc) · 7.35 KB

README.md

File metadata and controls

161 lines (98 loc) · 7.35 KB

header

Tech Stack

           

Coffee Order Chatbot

- Utilizing BERT fine-tuning for slot tagging

(Not supported in TensorFlow 1.x as of now 25.01.05)

  1. Export Pretrained BERT Model as a Module

    • This involves creating a BERT module from the checkpoint of a pretrained KorBERT model by ETRI
    • python export_korbert/bert_to_module.py -i {checkpoint_directory} -o {output_directory}
    • Example: python export_korbert/bert_to_module.py -i /content/drive/MyDrive/004_bert_eojeol_tensorflow -o /content/drive/MyDrive/bert-module
  2. Data Preparation

    2.1 Creating Required Files : seq.in and seq.out

    • Convert input data into format required for training, creaing seq.in(input sequences) and seq.out(output labels).
    • Command : python prepare_data.py process_file({input_data_path}, {output_path}), process_line(sentence, tokens)
    • Example : If the input is "라떼"(latte in Korean), it will be tokenized into "라" and "떼" for more accurate classification.

    2.2 Splitting Data into Train, Validation and Test Sets

    • Split the seq.in and seq.out files into train, validation, test sets in an 8:1:1 ratio.
    • Command : python split_new.py
  3. Fine-Tuning the Model

    • Train the model using the prepared datasets.
    • Command : python train.py -t {train_set_directory} -v {validation_set_directory} -s {model_save_directory} -e {num_epochs} -bs {batch_size}
  4. Model Evaluation

    • Evaludate the trained model using the test dataset.
    • Command : python eval.py -m {trained_model_directory} -d {test_set_directory}
    • The test results will be saved in the test_results folder under the specified model directory
  5. Inference

    • Use the trained model to make predictions on custom input sentences.
    • Command : python inference.py -m {trained_model_directory}
    • Example: python inference.py -m saved_model/
      • When "Enter your sentence:" appears, enter the sentence you want to test in the model.
      • To exit: enter 'quit', '종료', '그만', '멈춰', or 'stop'.

Project Overview

Coffe Order Chatbot

A chatbot based on the Starbucks menu that allows users to order beverages and food.

Note: The images included in this documentation are written in Korean.

image

01. Purpose of Development

  • The exisiting Starbucks Korea's Siren Order app is inconveninent and difficult to use, which motivated the development of an easier and more accessible chatbot service. image

02. Service Scenarios

  • Objective: To accurately idenfity cusomer orders using keyword extraction.
    • Example:
      • "아메리카노" (Americano), "라떼" (Latte) -> 음료 (Drink)
      • "쿠키"(Cookie), "케이크"(Cake) -> 음식 (Food)
      • "따뜻하게"(Hot), "차갑게"(Cold) -> 온도 (Temperature) image

Example

(Translation)

- "One grande cappuccino (beverage), hot, please. Also, please give me a raisin cookie (food)."
 "Is there anything else you need?"
- "No, that's all."
 "Your order will be one grande hot cappuccino and a raisin cookie."

image

Exception Handling Scenario

  • Planning for cases where empty slots or exceptions occur (e.g., unrecognized orders) and defining how the chatbot should respond.

(Translation)

- "One grande mango banana blended, please. Is it possible to add bubble tea?"
 "Unfortunately, that option is not available."
- "Why not?"
 "I'm sorry, but it's an unavailable option."

image

03. Fine-Tuning Method

Base Model : BERT (bidirectional representations from transformers)

  • We fine-tuned a pretrained KorBERT(Korean BERT) to suit the purpose of coffee order chatbot. image

Slot Tagging

  • Slot tagging is the process that assigns labels to specific words or phrases in a sentence allowing machines to understand the roles of words within sentences.(ref: Wikipedia) image

04. Data Collection Strategy

  • Web scraping of the Stackbuks Menu
  • Expanding data with different sentence structures using loop statements
  • Designing an ordering scenario using condifional statements
  • Exception handling for edge cases image

05. Service Development Plan

Development Steps

  • Design order scenarios → Build the dataset → Train the model (Fine-tuning) → Develop the web service → Integrate and deploy the model with the web image

Implementation

: Used Flask, Figma, HTML, and CSS to build a web-based chatbot system. image

Demonstration

image


Our Team

Seul Yi (Team Leader) : Chatbot Algorithm Design and BERT Fine-tuning for Slot Tagging
Park Mina : Chatbot Algorithm Design and BERT Fine-tuning for Slot Tagging
Jung Harim : Web Development and Presentation Design
Sumun Oh : Web Scraping and Development
Incheol Shin : Technical Lead