Skip to content

Commit

Permalink
rename the python package for pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
qiauil committed Aug 23, 2024
1 parent b62956b commit 6029733
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 46 deletions.
12 changes: 6 additions & 6 deletions ConFIG/grad_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def ConFIG_update_double(grad_1:torch.Tensor,grad_2:torch.Tensor,
Examples:
```python
from ConFIG.grad_operator import ConFIG_update_double
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIG_update_double
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
grads=[] # we record gradients rather than losses
Expand Down Expand Up @@ -93,8 +93,8 @@ def ConFIG_update(
Examples:
```python
from ConFIG.grad_operator import ConFIG_update
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIG_update
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
grads=[] # we record gradients rather than losses
Expand Down Expand Up @@ -191,8 +191,8 @@ class ConFIGOperator(GradientOperator):
Examples:
```python
from ConFIG.grad_operator import ConFIGOperator
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIGOperator
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
operator=ConFIGOperator() # initialize operator
for input_i in dataset:
Expand Down
12 changes: 6 additions & 6 deletions ConFIG/momentum_operator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from torch import Tensor
from torch.nn.modules import Module
from ConFIG import Sequence
from ConFIG.grad_operator import ConFIGOperator, GradientOperator
from ConFIG.utils import Sequence
from ConFIG.loss_recorder import LatestLossRecorder, LossRecorder
from conflictfree import Sequence
from conflictfree.grad_operator import ConFIGOperator, GradientOperator
from conflictfree.utils import Sequence
from conflictfree.loss_recorder import LatestLossRecorder, LossRecorder
from . import *
from .utils import *
from .loss_recorder import *
Expand Down Expand Up @@ -152,8 +152,8 @@ class PseudoMomentumOperator(MomentumOperator):
Examples:
```python
from ConFIG.momentum_operator import PseudoMomentumOperator
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.momentum_operator import PseudoMomentumOperator
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
operator=PseudoMomentumOperator(num_vector=len(loss_fns)) # initialize operator, the only difference here is we need to specify the number of gradient vectors.
for input_i in dataset:
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ url={https://arxiv.org/abs/2408.11104},

## Installation

* Install through `pip`: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install locally: Download and run `pip install .` or `install.sh` in terminal.
* Install through `pip`: `pip install conflictfree`
* Install from repository online: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install from repository offline: Download the repository and run `pip install .` or `install.sh` in terminal.
* Install from released wheel: Download the wheel and run `pip install conflictfree-x.x.x-py3-none-any.whl` in terminal.

## Usage

Expand All @@ -88,8 +90,8 @@ for input_i in dataset:
With `ConFIG`:

```python
from ConFIG.grad_operator import ConFIG_update
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIG_update
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
grads=[]
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/mtl_toy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
],
"source": [
"from tqdm import tqdm\n",
"from ConFIG.grad_operator import ConFIG_update\n",
"from conflictfree.grad_operator import ConFIG_update\n",
"scale=[0.1,1]\n",
"trajectories = [];losses = []\n",
"for init in inits:\n",
Expand Down Expand Up @@ -397,7 +397,7 @@
],
"source": [
"from tqdm import tqdm\n",
"from ConFIG.momentum_operator import PseudoMomentumOperator\n",
"from conflictfree.momentum_operator import PseudoMomentumOperator\n",
"\n",
"scale=[0.1,1]\n",
"trajectories = [];losses = []\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/pinn_burgers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from ConFIG.utils import get_para_vector,apply_para_vector\n",
"from conflictfree.utils import get_para_vector,apply_para_vector\n",
"\n",
"\n",
"class Tester():\n",
Expand Down Expand Up @@ -364,8 +364,8 @@
}
],
"source": [
"from ConFIG.grad_operator import ConFIG_update\n",
"from ConFIG.utils import get_gradient_vector,apply_gradient_vector\n",
"from conflictfree.grad_operator import ConFIG_update\n",
"from conflictfree.utils import get_gradient_vector,apply_gradient_vector\n",
"\n",
"torch.manual_seed(seed)\n",
"np.random.seed(seed)\n",
Expand Down Expand Up @@ -434,8 +434,8 @@
}
],
"source": [
"from ConFIG.utils import OrderedSliceSelector\n",
"from ConFIG.momentum_operator import PseudoMomentumOperator\n",
"from conflictfree.utils import OrderedSliceSelector\n",
"from conflictfree.momentum_operator import PseudoMomentumOperator\n",
"\n",
"torch.manual_seed(seed)\n",
"np.random.seed(seed)\n",
Expand Down
18 changes: 10 additions & 8 deletions docs/start/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## Installation

* Install through `pip`: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install locally: Download and run `pip install .` or `install.sh` in terminal.
* Install through `pip`: `pip install conflictfree`
* Install from repository online: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install from repository offline: Download the repository and run `pip install .` or `install.sh` in terminal.
* Install from released wheel: Download the wheel and run `pip install conflictfree-x.x.x-py3-none-any.whl` in terminal.

## Use ConFIG method

Expand All @@ -23,8 +25,8 @@ for input_i in dataset:
To use our ConFIG method, you can simply modify the code as

```python
from ConFIG.grad_operator import ConFIG_update
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIG_update
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
grads=[] # we record gradients rather than losses
Expand All @@ -41,8 +43,8 @@ for input_i in dataset:
Or, you can use our `ConFIGOperator` class:

```python
from ConFIG.grad_operator import ConFIGOperator
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIGOperator
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
operator=ConFIGOperator() # initialize operator
for input_i in dataset:
Expand All @@ -64,8 +66,8 @@ The `ConFIGOperator` class and `ConFIG_update` is basically the same, you can ch
The basic usage of `M-ConFIG` method in our code is similar to `ConFIGOperator` :

```python
from ConFIG.momentum_operator import PseudoMomentumOperator
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.momentum_operator import PseudoMomentumOperator
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
operator=PseudoMomentumOperator(num_vector=len(loss_fns)) # initialize operator, the only difference here is we need to specify the number of gradient vectors.
for input_i in dataset:
Expand Down
6 changes: 3 additions & 3 deletions experiments/MTL/methods/weight_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

from methods.min_norm_solvers import MinNormSolver, gradient_normalizers

from ConFIG.grad_operator import *
from ConFIG.momentum_operator import *
from ConFIG.helpers import OrderedSliceSelector
from conflictfree.grad_operator import *
from conflictfree.momentum_operator import *
from conflictfree.helpers import OrderedSliceSelector

EPS = 1e-8 # for numerical stability

Expand Down
2 changes: 1 addition & 1 deletion experiments/PINN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following code shows how to start a training:

```python
from lib_pinns.burgers.trainer import *
from ConFIG.grad_operator import *
from conflictfree.grad_operator import *

SAVE_PATH="./PINN_trained/burgers/"

Expand Down
4 changes: 2 additions & 2 deletions experiments/PINN/lib_pinns/trainer_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from .helpers import *
from .loss_weighter import *

from ConFIG.grad_operator import *
from ConFIG.momentum_operator import *
from conflictfree.grad_operator import *
from conflictfree.momentum_operator import *

def get_cosine_constant_lambda(initial_lr,final_lr,epochs,warmup_epoch,constant_start_epoch):
"""
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip uninstall ConFIG
pip uninstall conflictfree
rm -rf build dist foxutils.egg-info
python3 setup.py sdist bdist_wheel
cd dist
pip install ConFIG-*.whl
pip install conflictfree-*.whl
10 changes: 6 additions & 4 deletions pypi_desc.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ url={https://arxiv.org/abs/2408.11104},

## Installation

* Install through `pip`: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install locally: Download and run `pip install .` or `install.sh` in terminal.
* Install through `pip`: `pip install conflictfree`
* Install from repository online: `pip install git+https://github.com/tum-pbs/ConFIG`
* Install from repository offline: Download the repository and run `pip install .` or `install.sh` in terminal.
* Install from released wheel: Download the wheel and run `pip install conflictfree-x.x.x-py3-none-any.whl` in terminal.

## Usage

Expand All @@ -90,8 +92,8 @@ for input_i in dataset:
With `ConFIG`:

```python
from ConFIG.grad_operator import ConFIG_update
from ConFIG.utils import get_gradient_vector,apply_gradient_vector
from conflictfree.grad_operator import ConFIG_update
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
grads=[]
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def get_install_requires():
return targets

setuptools.setup(
name="ConFIG",
version="0.1.1",
author="Qiang Liu, Nils Thuerey",
name="conflictfree",
version="0.1.2",
author="Qiang Liu, Mengyu Chu, Nils Thuerey",
author_email="[email protected]",
description="Official implementation of Conflict-free Inverse Gradients method",
long_description=long_description,
Expand Down

0 comments on commit 6029733

Please sign in to comment.