mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Specify UTF-8 encoding in the json load command explicitely (#557)
This commit is contained in:
committed by
GitHub
parent
de60da9a6b
commit
4fb0ea9d1f
@@ -40,7 +40,7 @@ def download_and_load_gpt2(model_size, models_dir):
|
||||
|
||||
# Load settings and params
|
||||
tf_ckpt_path = tf.train.latest_checkpoint(model_dir)
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json")))
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json"), "r", encoding="utf-8"))
|
||||
params = load_gpt2_params_from_tf_ckpt(tf_ckpt_path, settings)
|
||||
|
||||
return settings, params
|
||||
|
||||
@@ -40,7 +40,7 @@ def download_and_load_gpt2(model_size, models_dir):
|
||||
|
||||
# Load settings and params
|
||||
tf_ckpt_path = tf.train.latest_checkpoint(model_dir)
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json")))
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json"), "r", encoding="utf-8"))
|
||||
params = load_gpt2_params_from_tf_ckpt(tf_ckpt_path, settings)
|
||||
|
||||
return settings, params
|
||||
|
||||
@@ -40,7 +40,7 @@ def download_and_load_gpt2(model_size, models_dir):
|
||||
|
||||
# Load settings and params
|
||||
tf_ckpt_path = tf.train.latest_checkpoint(model_dir)
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json")))
|
||||
settings = json.load(open(os.path.join(model_dir, "hparams.json"), "r", encoding="utf-8"))
|
||||
params = load_gpt2_params_from_tf_ckpt(tf_ckpt_path, settings)
|
||||
|
||||
return settings, params
|
||||
|
||||
Reference in New Issue
Block a user