Skip to content

Instantly share code, notes, and snippets.

View ashleve's full-sized avatar
🐢
I may be slow to respond.

Lukas ashleve

🐢
I may be slow to respond.
  • Warsaw
View GitHub Profile

Automatic activation of virtual environment and tab completion when entering folder

  1. Create a new file called .autoenv (this name is excluded from version control in .gitignore).
    You can use it to automatically execute shell commands when entering folder. Add some commands to your .autoenv file, like in the example below:

    # activate conda environment
    conda activate myenv
    

activate hydra tab completion for bash

@ashleve
ashleve / Dockerfile
Created May 19, 2021 00:47
Dockerfile for lightning-hydra-template
# Build commands:
# docker build -t project_name .
# docker run --gpus all -it --rm project_name
# Build from official Nvidia PyTorch image
# GPU-ready with built in Apex mixed-precision support
# https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
FROM nvcr.io/nvidia/pytorch:21.04-py3
@ashleve
ashleve / kfold_example.py
Last active April 24, 2024 10:54
Example of k-fold cross validation with PyTorch Lightning Datamodule
from pytorch_lightning import LightningDataModule
from torch_geometric.datasets import TUDataset
from torch_geometric.data import DataLoader
from sklearn.model_selection import KFold
class ProteinsKFoldDataModule(LightningDataModule):
def __init__(
self,
data_dir: str = "data/",