{"id":15601001,"url":"https://github.com/lucidrains/etsformer-pytorch","last_synced_at":"2025-04-07T05:09:25.994Z","repository":{"id":57427154,"uuid":"455938817","full_name":"lucidrains/ETSformer-pytorch","owner":"lucidrains","description":"Implementation of ETSformer, state of the art time-series Transformer, in Pytorch","archived":false,"fork":false,"pushed_at":"2023-08-26T18:01:55.000Z","size":231,"stargazers_count":152,"open_issues_count":3,"forks_count":20,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-31T04:05:39.168Z","etag":null,"topics":["artificial-intelligence","deep-learning","exponential-smoothing","time-series","transformers"],"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}},"created_at":"2022-02-05T17:34:38.000Z","updated_at":"2025-02-18T07:56:24.000Z","dependencies_parsed_at":"2024-10-23T02:50:41.307Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/ETSformer-pytorch","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"68f9ed9fa361e4a9966fb192275b686eacf00745"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FETSformer-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FETSformer-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FETSformer-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FETSformer-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/ETSformer-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595334,"owners_count":20963943,"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":["artificial-intelligence","deep-learning","exponential-smoothing","time-series","transformers"],"created_at":"2024-10-03T02:11:26.911Z","updated_at":"2025-04-07T05:09:25.974Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./etsformer.png\" width=\"400px\"\u003e\u003c/img\u003e\n\n## ETSformer - Pytorch\n\nImplementation of \u003ca href=\"https://arxiv.org/abs/2202.01381\"\u003eETSformer\u003c/a\u003e, state of the art time-series Transformer, in Pytorch\n\n## Install\n\n```bash\n$ pip install etsformer-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom etsformer_pytorch import ETSFormer\n\nmodel = ETSFormer(\n    time_features = 4,\n    model_dim = 512,                # in paper they use 512\n    embed_kernel_size = 3,          # kernel size for 1d conv for input embedding\n    layers = 2,                     # number of encoder and corresponding decoder layers\n    heads = 8,                      # number of exponential smoothing attention heads\n    K = 4,                          # num frequencies with highest amplitude to keep (attend to)\n    dropout = 0.2                   # dropout (in paper they did 0.2)\n)\n\ntimeseries = torch.randn(1, 1024, 4)\n\npred = model(timeseries, num_steps_forecast = 32) # (1, 32, 4) - (batch, num steps forecast, num time features)\n```\n\nFor using ETSFormer for classification, using cross attention pooling on all latents and level output\n\n```python\nimport torch\nfrom etsformer_pytorch import ETSFormer, ClassificationWrapper\n\netsformer = ETSFormer(\n    time_features = 1,\n    model_dim = 512,\n    embed_kernel_size = 3,\n    layers = 2,\n    heads = 8,\n    K = 4,\n    dropout = 0.2\n)\n\nadapter = ClassificationWrapper(\n    etsformer = etsformer,\n    dim_head = 32,\n    heads = 16,\n    dropout = 0.2,\n    level_kernel_size = 5,\n    num_classes = 10\n)\n\ntimeseries = torch.randn(1, 1024)\n\nlogits = adapter(timeseries) # (1, 10)\n```\n\n## Citation\n\n```bibtex\n@misc{woo2022etsformer,\n    title   = {ETSformer: Exponential Smoothing Transformers for Time-series Forecasting}, \n    author  = {Gerald Woo and Chenghao Liu and Doyen Sahoo and Akshat Kumar and Steven Hoi},\n    year    = {2022},\n    eprint  = {2202.01381},\n    archivePrefix = {arXiv},\n    primaryClass = {cs.LG}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fetsformer-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fetsformer-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fetsformer-pytorch/lists"}