{"id":19647048,"url":"https://github.com/idsia/kohonen-vae","last_synced_at":"2025-04-28T15:31:13.047Z","repository":{"id":79448574,"uuid":"601202023","full_name":"IDSIA/kohonen-vae","owner":"IDSIA","description":"Official repository for the paper \"Topological Neural Discrete Representation Learning à la Kohonen\" (ICML 2023 Workshop on Sampling and Optimization in Discrete Space)","archived":false,"fork":false,"pushed_at":"2023-04-27T06:29:42.000Z","size":79,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T09:23:03.202Z","etag":null,"topics":["kohonen-map","pytorch","self-organizing-map","vector-quantization","vq-vae"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IDSIA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-13T15:22:10.000Z","updated_at":"2024-12-25T14:15:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"300e8e90-166a-4e4b-88b8-3fb1a41688e9","html_url":"https://github.com/IDSIA/kohonen-vae","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDSIA%2Fkohonen-vae","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDSIA%2Fkohonen-vae/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDSIA%2Fkohonen-vae/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDSIA%2Fkohonen-vae/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IDSIA","download_url":"https://codeload.github.com/IDSIA/kohonen-vae/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251338604,"owners_count":21573584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kohonen-map","pytorch","self-organizing-map","vector-quantization","vq-vae"],"created_at":"2024-11-11T14:42:09.836Z","updated_at":"2025-04-28T15:31:13.034Z","avatar_url":"https://github.com/IDSIA.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Official source code for our paper \"Topological Neural Discrete Representation Learning à la Kohonen\"\n\n## TLDR\n\nIf you want to reuse the KSOM layer, look at `layers/som_vector_quantizer.py`. It has no external dependencies and supports multi-GPU training.\n\nAn example:\n\n```python\nfrom layers.som_vector_quantizer import SOMGeometry, Grid, HardSOM, HardNeighborhood\n\ngeometry = SOMGeometry(\n    Grid(2),\n    HardNeighborhood(0.1)\n)\n\nquantizer = HardSOM(128, 512, 0.99, geometry)\n\nloss, output, perplexity, _ = quantizer(input)\n```\n\nYou can also take a look at `example.py`.\n\n## Installation\n\nThis project requires Python 3 and PyTorch 1.8.\n\n```bash\npip3 install -r requirements.txt\n```\n\nCreate a Weights and Biases account and run\n```bash\nwandb login\n```\n\nMore information on setting up Weights and Biases can be found on\nhttps://docs.wandb.com/quickstart.\n\nFor plotting, LaTeX is required (to avoid Type 3 fonts and to render symbols). Installation is OS specific.\n\n## Usage\n\nThe code makes use of Weights and Biases for experiment tracking. In the \"sweeps\" directory, we provide sweep configurations for all experiments we have performed. The sweeps are officially meant for hyperparameter optimization, but we use them to run 10 instances of each experiment.\n\nTo reproduce our results, start a sweep for each of the YAML files in the \"sweeps\" directory. Run wandb agent for each of them in the main directory. This will run all the experiments, and they will be displayed on the W\u0026B dashboard.\n\n### Re-creating plots from the paper\n\nEdit config file \"paper/config.json\". Enter your project name in the field \"wandb_project\" (e.g. \"username/modules\").\n\nRun the script of interest within the \"paper\" directory. For example:\n\n```bash\ncd paper/kohonen\npython3 compare_init.py\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidsia%2Fkohonen-vae","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidsia%2Fkohonen-vae","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidsia%2Fkohonen-vae/lists"}