(Not supported in TensorFlow 1.x as of now 25.01.05)
-
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
-
Data Preparation
2.1 Creating Required Files :
seq.in
andseq.out
- Convert input data into format required for training, creaing
seq.in
(input sequences) andseq.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
andseq.out
files into train, validation, test sets in an 8:1:1 ratio. - Command :
python split_new.py
- Convert input data into format required for training, creaing
-
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}
-
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
-
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'.
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.
- 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.
- Objective: To accurately idenfity cusomer orders using keyword extraction.
(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."
- 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."
- 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)
- 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
- Design order scenarios → Build the dataset → Train the model (Fine-tuning) → Develop the web service → Integrate and deploy the model with the web
: Used Flask, Figma, HTML, and CSS to build a web-based chatbot system.