From b7e194a7560a0d10189bc39fbc18aa811beae36b Mon Sep 17 00:00:00 2001 From: Adam Isakov <99123480+adambala@users.noreply.github.com> Date: Fri, 26 Jan 2024 01:10:10 +0300 Subject: [PATCH 1/2] feature: .gitignore - added venv folders --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a3c82a2..cc343fe 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ __pycache__/ *.pt *.pyc input.txt +env/ +venv/ \ No newline at end of file From f35dc82437cfe603bbafa9fccdf5d245cefe6f59 Mon Sep 17 00:00:00 2001 From: Adam Isakov <99123480+adambala@users.noreply.github.com> Date: Fri, 26 Jan 2024 01:34:44 +0300 Subject: [PATCH 2/2] fix: prepare.py - added input file opening in UTF-8 encoding --- data/shakespeare/prepare.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/shakespeare/prepare.py b/data/shakespeare/prepare.py index 71c88da..bda25b1 100644 --- a/data/shakespeare/prepare.py +++ b/data/shakespeare/prepare.py @@ -7,10 +7,10 @@ import numpy as np input_file_path = os.path.join(os.path.dirname(__file__), 'input.txt') if not os.path.exists(input_file_path): data_url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt' - with open(input_file_path, 'w') as f: + with open(input_file_path, 'w', encoding='utf-8') as f: f.write(requests.get(data_url).text) -with open(input_file_path, 'r') as f: +with open(input_file_path, 'r', encoding='utf-8') as f: data = f.read() n = len(data) train_data = data[:int(n*0.9)]