<jupyter_start><jupyter_text><jupyter_code>"""cloning dialogue generation models running code"""
!git clone https://github.com/snoop2head/dialogue-generation-models
"""Installing pretrained Language Models from Google Drive"""
# Estimated Execution Time: 4 mins 30 seconds

import os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

# 1. Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)

# Choose a local colab directory to store the data.
PATH = "./dialogue-generation-models/models"
local_download_path = os.path.expanduser(PATH)
try:
  os.makedirs(local_download_path)
except: pass

# 2. Auto-iterate using the query syntax
#    https://developers.google.com/drive/v2/web/search-parameters
file_list = drive.ListFile(
    {'q': "'1HCbvJllHr5eGxFQ69sn3Fb2nM2vrJeKs' in parents"}).GetList() # query of the google drive directory

for f in file_list:
  # 3. Create & download by id.
  print('title: %s, id: %s' % (f['title'], f['id']))
  fname = os.path.join(local_download_path, f['title'])
  print('downloading to {}'.format(fname))
  f_ = drive.CreateFile({'id': f['id']})
  f_.GetContentFile(fname)
# Get current working directory
import os
cwd = os.getcwd()
print("current working directory:",cwd)
# switch directory into forked github repository
%cd dialogue-generation-models/
!ls
# install requirements
# Execution time: 3 min
!pip install -r requirements.txt
# Running Script for sample dialogue
# Input ["최근에 영화 본 거 있어?", "기생충 봤는데 엄청 재밌더라", "오 그래? 다들 재밌다고 하더라", "아직 못봤어?", "응 나도 봐야하나.."],
!python run_meena.py \
--pretrained-model-path /content/dialogue-generation-models/models/large_meena_trained_on_filtered_data_kr.pth \
        --model-config-path /content/dialogue-generation-models/configs/large_meena_config.json \
        --tokenizer-model-path /content/dialogue-generation-models/tokenizer/kr_spm.model \
        --decoding-method top_p<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12005649717514125, 'fraction_numerical': 0.00800376647834275, 'mean_word_length': 5.019830028328612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '234519', 'license': 'Apache-2.0', 'n_tokens_mistral': 762, 'n_tokens_neox': 760, 'n_words': 181, 'path': 'use_chatbot.ipynb', 'repo_name': 'snoop2head/dialogue-generation-models', 'size': '2124'}