{"id":33546445,"url":"https://github.com/lucidrains/hs-tasnet","last_synced_at":"2025-11-27T05:06:39.340Z","repository":{"id":307688658,"uuid":"1030320041","full_name":"lucidrains/HS-TasNet","owner":"lucidrains","description":"Implementation of HS-TasNet, \"Real-time Low-latency Music Source Separation using Hybrid Spectrogram-TasNet\"","archived":false,"fork":false,"pushed_at":"2025-09-08T23:38:28.000Z","size":467,"stargazers_count":55,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-10T16:42:15.506Z","etag":null,"topics":["artificial-intelligence","deep-learning","music-separation","real-time"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucidrains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-08-01T12:46:45.000Z","updated_at":"2025-09-08T23:38:27.000Z","dependencies_parsed_at":"2025-08-01T16:39:25.934Z","dependency_job_id":"3e7a0e63-9c32-40e6-a8ab-f13361c886ae","html_url":"https://github.com/lucidrains/HS-TasNet","commit_stats":null,"previous_names":["lucidrains/hs-tasnet"],"tags_count":79,"template":false,"template_full_name":null,"purl":"pkg:github/lucidrains/HS-TasNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FHS-TasNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FHS-TasNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FHS-TasNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FHS-TasNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/HS-TasNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FHS-TasNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"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","status":"online","status_checked_at":"2025-11-27T02:00:05.795Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["artificial-intelligence","deep-learning","music-separation","real-time"],"created_at":"2025-11-27T05:06:33.861Z","updated_at":"2025-11-27T05:06:34.869Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./fig1.png\" width=\"350px\"\u003e\u003c/img\u003e\n\n## HS-TasNet\n\nImplementation of [HS-TasNet](https://arxiv.org/abs/2402.17701), \"Real-time Low-latency Music Source Separation using Hybrid Spectrogram-TasNet\", proposed by the research team at L-Acoustics\n\n## Install\n\n```bash\n$ pip install HS-TasNet\n```\n\n## Usage\n\n```python\nimport torch\nfrom hs_tasnet import HSTasNet\n\nmodel = HSTasNet()\n\naudio = torch.randn(1, 2, 204800) # ~5 seconds of stereo\n\nseparated_audios, _ = model(audio)\n\nassert separated_audios.shape == (1, 4, 2, 204800) # second dimension is the separated tracks\n```\n\nWith the `Trainer`\n\n```python\n# model\n\nfrom hs_tasnet import HSTasNet, Trainer\n\nmodel = HSTasNet()\n\n# trainer\n\ntrainer = Trainer(\n    model,\n    dataset = None,               # add your in-house Dataset\n    concat_musdb_dataset = True,  # concat the musdb dataset automatically\n    batch_size = 2,\n    max_steps = 2,\n    cpu = True,\n)\n\ntrainer()\n\n# after much training\n# inferencing\n\nmodel.sounddevice_stream(\n    duration_seconds = 2,\n    return_reduced_sources = [0, 2]\n)\n\n# or from the exponentially smoothed model (in the trainer)\n\ntrainer.ema_model.sounddevice_stream(...)\n\n# or you can load from a specific checkpoint\n\nmodel.load('./checkpoints/path.to.desired.ckpt.pt')\nmodel.sounddevice_stream(...)\n\n# to load an HS-TasNet from any of the saved checkpoints, without having to save its hyperparameters, just run\n\nmodel = HSTasNet.init_and_load_from('./checkpoints/path.to.desired.ckpt.pt')\n\n```\n\n## Training script\n\nFirst make sure dependencies are there by running\n\n```shell\n$ sh scripts/install.sh\n```\n\nThen make sure `uv` is installed\n\n```shell\n$ pip install uv\n```\n\nFinally run the following to train a newly initialized model on a small subset of MusDB, and make sure the loss goes down\n\n```shell\n$ uv run train.py\n```\n\nFor distributed training, you just need to run `accelerate config` first, courtesy of [`accelerate` from 🤗](https://huggingface.co/docs/accelerate/en/index) but single machine is fine too\n\n## Experiment tracking\n\nTo enable online experiment monitoring / tracking, you need to have `wandb` installed and logged in\n\n```shell\n$ pip install wandb \u0026\u0026 wandb login\n```\n\nThen\n\n```shell\n$ uv run train.py --use-wandb\n```\n\nTo wipe the previous checkpoints and evaluated results, append `--clear-folders`\n\n## Test\n\n```shell\n$ uv pip install '.[test]' --system\n```\n\nThen\n\n```shell\n$ pytest tests\n```\n\n## Sponsors\n\nThis open sourced work is sponsored by [Sweet Spot](https://github.com/sweetspotsoundsystem)\n\n## Citations\n\n```bibtex\n@misc{venkatesh2024realtimelowlatencymusicsource,\n    title    = {Real-time Low-latency Music Source Separation using Hybrid Spectrogram-TasNet}, \n    author   = {Satvik Venkatesh and Arthur Benilov and Philip Coleman and Frederic Roskam},\n    year     = {2024},\n    eprint   = {2402.17701},\n    archivePrefix = {arXiv},\n    primaryClass = {eess.AS},\n    url      = {https://arxiv.org/abs/2402.17701}, \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fhs-tasnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fhs-tasnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fhs-tasnet/lists"}