Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions swanlab/proto/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,27 @@ def to_file_model(self, file_dir) -> FileModel:
conda_path = os.path.join(file_dir, self.conda_filename)
if not os.path.exists(os.path.join(file_dir, self.conda_filename)):
raise FileNotFoundError(f"Conda file {self.conda_filename} not found in {file_dir}")
conda = open(conda_path, "r").read()
conda = open(conda_path, "r", encoding="utf-8").read()
if self.requirements_filename:
requirements_path = os.path.join(file_dir, self.requirements_filename)
if not os.path.exists(requirements_path):
raise FileNotFoundError(f"Requirements file {self.requirements_filename} not found in {file_dir}")
requirements = open(requirements_path, "r").read()
requirements = open(requirements_path, "r", encoding="utf-8").read()
if self.metadata_filename:
metadata_path = os.path.join(file_dir, self.metadata_filename)
if not os.path.exists(metadata_path):
raise FileNotFoundError(f"Metadata file {self.metadata_filename} not found in {file_dir}")
metadata = json.loads(open(metadata_path, "r").read())
metadata = json.loads(open(metadata_path, "r", encoding="utf-8").read())
if self.config_filename:
config_path = os.path.join(file_dir, self.config_filename)
if not os.path.exists(config_path):
raise FileNotFoundError(f"Config file {self.config_filename} not found in {file_dir}")
config = yaml.safe_load(open(config_path, "r").read())
config = yaml.safe_load(open(config_path, "r", encoding="utf-8").read())

return FileModel(conda=conda, requirements=requirements, metadata=metadata, config=config)



class Column(BaseModel):

key: str # 列的唯一标识符
Expand Down