This document outlines the coding and collaboration standards we'll follow to ensure our project is consistent, maintainable, and easy to work on.
feat/train-scripts. Don’t have meaningless branch names.main and merge to main as soon as the feature is implemented. All branches that are merged should be deleted after the merge. All branches should be squashed and merged (this could be set as the default in GitHub settings).main Branch:
main branch directly. I’ll be protecting the main branch from doing so. Changes will only be made to the main branch through a reviewed and approved PR.main needs to be stable. This means that all existing tests must pass. If not, first fix the tests in the feature branch and once they pass, only then is the PR merged.> 5 MB should be consulted before committing..gitignore to add something like .code-workspace to it along with adding a new function to a separate script, then both changes should be committed separately. If, on the other hand, you renamed a file somewhere and thus to import it, you also changed the name in the entire codebase, all those changes should be committed together.Function Docstring Format: The format of a function docstring should be as follows. This should include a description of the function. Don’t have one single long line. If the description is long, split into multiple lines.
def create_folder_structure(
base_data_dir: Path, total_files: int, files_per_folder: int = 1000
) -> Dict[int, Path]:
"""Create numbered folders for organizing structure files.
Args:
base_data_dir (Path) : Base directory
total_files (int) : Total number of files to process
files_per_folder (int) : Number of files per subfolder.
Defaults to 1000
Returns:
dict: Dictionary mapping folder numbers to folder paths
"""
unzipped_dir = base_data_dir / "cif_unzipped"
unzipped_dir.mkdir(exist_ok=True)
Tensor Shapes: With tensors, it’s also wise to specify the Expected shape.
def concat_tensors(tensor_1: torch.Tensor, tensor_2: torch.Tensor) -> torch.Tensor:
"""
Concats two tensors
Args:
tensor_1 (torch.Tensor): First tensor.
Expected Shape: batch_size * sequence_length * embedding_size
"""
concat_tensor = torch.cat(tensor_1, tensor_2)
return concat_tensor