What's the difference between the two? You can read one, but you can't read the other.
Code 2 tried to code https://github.com/graykode/ALBERT-Pytorch
Code 1 cuts out the part where the error occurred
Code 1 moves
import json json.load(open('config/pretrain.json')) print ("aaaa")
Code 2 doesn't work
class Config (NamedTuple): """ Hyperparameters for training "" seed: int = 3431 # random seed batch_size —int=8 lr —int=5e-5#learning rate n_epochs: int=10#the number of epoch # `warm up`period=warmup(0.1)*total_steps # linear increasing learning rate from zero to the specified value (5e-5) warmup:float=0.1 save_steps: int=100# interval for saving model total_steps: int = 100000 # total number of steps to train @classmethod def from_json(cls, file):# load config from json file return cls(**json.load(open(file, "r"))))
Error Content I have verified that the file variable (directory) is the same as code 1
Traceback (most recent call last): File "pretrain.py", line 285, in<module> main(args=args) File "pretrain.py", line 211, in main cfg = train.Config.from_json(args.train_cfg) File "C:\Users\PC_User\newAI2022y08y23d\project\ALBERT-Pytorch-master\train.py", line 32, in from_json return cls(**json.load(open(file, "r")))) FileNotFoundError: [Errno2] No such file or directory: "'config/pretrain.json'"
FileNotFoundError: [Errno2] No such file or directory: "'config/pretrain.json'"
If the error message is correct, it appears that there is an unnecessary
' around the filename.
356 I want to create an array of sequences from "1" to a specified number.
356 Unity Virtual Stick Does Not Return to Center When You Release Your Finger
341 Understanding the Meaning of mpm prefork Settings
367 To Limit Column Values to Strings in a String List Using sqlalchemy
346 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2023 OneMinuteCode. All rights reserved.