-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Collaborative-Coding-Exam wiki!
We are deciding on a project structure.
Currently we think a structure like the one below looks good:
Changes should preferably first start out as an issue. Then create your own branch and open a pull-request to the main
branch which would need to be approved by 2 other maintainers.
List existing tags:
git tag
make new tag:
git tag -a v1.x.x -m "Some tag message"
Push the tag:
git push origin v1.x.x
We are deciding on a project structure.
Currently we think a structure like the one below looks good:
```sh
doc/
src/
utils/
metrics.py or metrics/
models.py or models/
data/
MNIST/
SVHN/
USPS/
etc../
results/
experiments/
import torch.nn as nn
class MyMetric(nn.Module):
def __init__(self, ...):
super().__init__()
...
def forward(self, x):
x_copy = x.copy()
...
return x_copy
from torch.utils.data import Dataset
class MyDataset(Dataset):
def __init__(self, ...):
super().__init__()
# Fetch data or check if data exists
...
def __len__(self):
return
def __getitem__(self, id):
return
ruff
and isort
are good alternatives for formatting.
Once installed, either run the formatter using ruff format somedir/
and isort format somedir/
.
Alternatively you can set up a pre-commit hook, which will run the formatters automatically once you commit a change locally.
Put:
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')
[ -z "$FILES" ] && exit 0
# Format code
echo "$FILES" | xargs ruff format
echo "$FILES" | xargs isort format
# Add back the modified files to staging
echo "$FILES" | xargs git add
exit 0
Into .git/hooks/pre-commit
in your clone of this repository, then make the script executable: chmod +x .git/hooks/pre-commit
.
"""
My numpydoc description of a kind
of very exhautive numpydoc format docstring.
Parameters
----------
first : array_like
the 1st param name `first`
second :
the 2nd param
third : {'value', 'other'}, optional
the 3rd param, by default 'value'
Returns
-------
string
a value in a string
Raises
------
KeyError
when a key error
OtherError
when an other error
"""