Skip to content

Commit 05867e6

Browse files
committed
project creation for release on pip
1 parent 62528af commit 05867e6

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [ published ]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
publish:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: '3.x' # Set your desired Python version
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install build twine
34+
35+
- name: Build the package
36+
run: python -m build
37+
38+
- name: Publish to TestPyPI
39+
env:
40+
TWINE_USERNAME: __token__
41+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
42+
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
43+
run: python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
44+
# run: python -m twine upload dist/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/venv/
2+
/.venv/
23
/.idea/

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
# Learnable Fourier Features for Multi-Dimensional Spatial Positional Encoding
22

33
Implementation of [Learnable Fourier Features for Multi-Dimensional Spatial Positional Encoding](https://arxiv.org/abs/2106.02795) by Li, Si, Li, Hsieh and Bengio.
4+
5+
## Installation
6+
7+
```bash
8+
pip install learnable_fourier_positional_encoding
9+
```
10+
11+
## Usage
12+
13+
```python
14+
import torch
15+
from learnable_fourier_positional_encoding import LearnableFourierPositionalEncoding
16+
17+
G = 3
18+
M = 17
19+
x = torch.randn((97, G, M))
20+
enc = LearnableFourierPositionalEncoding(G, M, 768, 32, 768, 10)
21+
pex = enc(x)
22+
print(pex.shape)
23+
```

pyproject.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "learnable_fourier_positional_encoding"
7+
version = "0.0.1"
8+
authors = [
9+
{ name = "William Guimont-Martin", email = "[email protected]" },
10+
]
11+
description = "Learnable Fourier Features for Multi-Dimensional Spatial Positional Encoding "
12+
readme = "README.md"
13+
license = { file = "LICENSE" }
14+
requires-python = ">=3.8"
15+
dependencies = ["numpy", "torch"]
16+
classifiers = [
17+
"Programming Language :: Python :: 3",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
]
21+
22+
[project.urls]
23+
Homepage = "https://github.com/willGuimont/learnable_fourier_positional_encoding"
24+
Issues = "https://github.com/willGuimont/learnable_fourier_positional_encoding/issues"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Learnable Fourier Features for Multi-Dimensional Spatial Positional Encoding """
2+
3+
from .learnable_fourier_pos_encoding import LearnableFourierPositionalEncoding
4+
5+
__all__ = ["LearnableFourierPositionalEncoding"]
6+
__version__ = '0.0.1'

learnable_fourier_pos_encoding.py renamed to src/learnable_fourier_pos_encoding/learnable_fourier_pos_encoding.py

File renamed without changes.

0 commit comments

Comments
 (0)