diff --git a/ConFIG/grad_operator.py b/ConFIG/grad_operator.py index f0d96b9..898bec1 100644 --- a/ConFIG/grad_operator.py +++ b/ConFIG/grad_operator.py @@ -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 @@ -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 @@ -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: diff --git a/ConFIG/momentum_operator.py b/ConFIG/momentum_operator.py index a49c1c3..32f1fbd 100644 --- a/ConFIG/momentum_operator.py +++ b/ConFIG/momentum_operator.py @@ -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 * @@ -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: diff --git a/README.md b/README.md index faf66c3..86bbd46 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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=[] diff --git a/docs/examples/mtl_toy.ipynb b/docs/examples/mtl_toy.ipynb index 9896612..b1d4a97 100644 --- a/docs/examples/mtl_toy.ipynb +++ b/docs/examples/mtl_toy.ipynb @@ -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", @@ -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", diff --git a/docs/examples/pinn_burgers.ipynb b/docs/examples/pinn_burgers.ipynb index f70b07a..6782dfe 100644 --- a/docs/examples/pinn_burgers.ipynb +++ b/docs/examples/pinn_burgers.ipynb @@ -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", @@ -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", @@ -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", diff --git a/docs/start/start.md b/docs/start/start.md index b52ac2f..967ea9a 100644 --- a/docs/start/start.md +++ b/docs/start/start.md @@ -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 @@ -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 @@ -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: @@ -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: diff --git a/experiments/MTL/methods/weight_methods.py b/experiments/MTL/methods/weight_methods.py index 5a14b15..3a29d69 100644 --- a/experiments/MTL/methods/weight_methods.py +++ b/experiments/MTL/methods/weight_methods.py @@ -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 diff --git a/experiments/PINN/README.md b/experiments/PINN/README.md index 4a532e4..5d90de9 100644 --- a/experiments/PINN/README.md +++ b/experiments/PINN/README.md @@ -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/" diff --git a/experiments/PINN/lib_pinns/trainer_basis.py b/experiments/PINN/lib_pinns/trainer_basis.py index 541eab6..c2636ca 100644 --- a/experiments/PINN/lib_pinns/trainer_basis.py +++ b/experiments/PINN/lib_pinns/trainer_basis.py @@ -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): """ diff --git a/install.sh b/install.sh index 0b6289d..3e74779 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/pypi_desc.md b/pypi_desc.md index 1f8d2a9..80fcc8a 100644 --- a/pypi_desc.md +++ b/pypi_desc.md @@ -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 @@ -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=[] diff --git a/setup.py b/setup.py index f01687b..2c4bd58 100644 --- a/setup.py +++ b/setup.py @@ -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="qiangliu.7@outlook.com", description="Official implementation of Conflict-free Inverse Gradients method", long_description=long_description,