causal-conv1d


Namecausal-conv1d JSON
Version 1.4.0 PyPI version JSON
download
home_pagehttps://github.com/Dao-AILab/causal-conv1d
SummaryCausal depthwise conv1d in CUDA, with a PyTorch interface
upload_time2024-06-29 02:27:20
maintainerNone
docs_urlNone
authorTri Dao
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Causal depthwise conv1d in CUDA with a PyTorch interface

Features:
- Support fp32, fp16, bf16.
- Kernel size 2, 3, 4.

## How to use

```
from causal_conv1d import causal_conv1d_fn
```

```
def causal_conv1d_fn(x, weight, bias=None, activation=None):
    """
    x: (batch, dim, seqlen)
    weight: (dim, width)
    bias: (dim,)
    activation: either None or "silu" or "swish"

    out: (batch, dim, seqlen)
    """
```

Equivalent to:
```
import torch.nn.functional as F

F.conv1d(x, weight.unsqueeze(1), bias, padding=width - 1, groups=dim)[..., :seqlen]
```

## Additional Prerequisites for AMD cards

### Patching ROCm

If you are on ROCm 6.0, run the following steps to avoid errors during compilation. This is not required for ROCm 6.1 onwards.

1. Locate your ROCm installation directory. This is typically found at `/opt/rocm/`, but may vary depending on your installation.

2. Apply the Patch. Run with `sudo` in case you encounter permission issues.
   ```bash
    patch /opt/rocm/include/hip/amd_detail/amd_hip_bf16.h < rocm_patch/rocm6_0.patch 
   ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Dao-AILab/causal-conv1d",
    "name": "causal-conv1d",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tri Dao",
    "author_email": "tri@tridao.me",
    "download_url": "https://files.pythonhosted.org/packages/3f/28/c21f5059837c6426c0e15eaf7ada62febe00ccc3f23a4f6b3b9029bbdf8a/causal_conv1d-1.4.0.tar.gz",
    "platform": null,
    "description": "# Causal depthwise conv1d in CUDA with a PyTorch interface\n\nFeatures:\n- Support fp32, fp16, bf16.\n- Kernel size 2, 3, 4.\n\n## How to use\n\n```\nfrom causal_conv1d import causal_conv1d_fn\n```\n\n```\ndef causal_conv1d_fn(x, weight, bias=None, activation=None):\n    \"\"\"\n    x: (batch, dim, seqlen)\n    weight: (dim, width)\n    bias: (dim,)\n    activation: either None or \"silu\" or \"swish\"\n\n    out: (batch, dim, seqlen)\n    \"\"\"\n```\n\nEquivalent to:\n```\nimport torch.nn.functional as F\n\nF.conv1d(x, weight.unsqueeze(1), bias, padding=width - 1, groups=dim)[..., :seqlen]\n```\n\n## Additional Prerequisites for AMD cards\n\n### Patching ROCm\n\nIf you are on ROCm 6.0, run the following steps to avoid errors during compilation. This is not required for ROCm 6.1 onwards.\n\n1. Locate your ROCm installation directory. This is typically found at `/opt/rocm/`, but may vary depending on your installation.\n\n2. Apply the Patch. Run with `sudo` in case you encounter permission issues.\n   ```bash\n    patch /opt/rocm/include/hip/amd_detail/amd_hip_bf16.h < rocm_patch/rocm6_0.patch \n   ```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Causal depthwise conv1d in CUDA, with a PyTorch interface",
    "version": "1.4.0",
    "project_urls": {
        "Homepage": "https://github.com/Dao-AILab/causal-conv1d"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f28c21f5059837c6426c0e15eaf7ada62febe00ccc3f23a4f6b3b9029bbdf8a",
                "md5": "7b8b4347322a41dd0f3e9d22c4c6f64f",
                "sha256": "e741fe453d708bc19be1ed71ff628cb2ed1a4b1be0e4e2fa574d09ce9a4970c3"
            },
            "downloads": -1,
            "filename": "causal_conv1d-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7b8b4347322a41dd0f3e9d22c4c6f64f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9288,
            "upload_time": "2024-06-29T02:27:20",
            "upload_time_iso_8601": "2024-06-29T02:27:20.969725Z",
            "url": "https://files.pythonhosted.org/packages/3f/28/c21f5059837c6426c0e15eaf7ada62febe00ccc3f23a4f6b3b9029bbdf8a/causal_conv1d-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-29 02:27:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dao-AILab",
    "github_project": "causal-conv1d",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "causal-conv1d"
}
        
Elapsed time: 0.28110s