Skip to content

Commit 344ce24

Browse files
author
LEFTeyes
committed
upgrade in install dependencies
1 parent d3fc966 commit 344ce24

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
## Description
1010

11-
A Warmup Scheduler for Pytorch to achieve the warmup learning rate at the beginning of training.
11+
A Warmup Scheduler for Pytorch to make the warmup learning rate change at the beginning of training.
1212

1313
## setup
1414

15+
Notice: need to install pytorch>=1.1.0 manually. \
16+
The official website of pytorch is: https://pytorch.org/
17+
18+
Then install as follows:
19+
1520
```
1621
pip install warmup_scheduler_pytorch
1722
```
@@ -26,7 +31,7 @@ import torch
2631
from torch.optim import SGD # example
2732
from torch.optim.lr_scheduler import CosineAnnealingLR # example
2833

29-
from warmup_scheduler_pytorch.warmup_module import WarmUpScheduler
34+
from warmup_scheduler_pytorch import WarmUpScheduler
3035

3136
model = Model()
3237
optimizer = SGD(model.parameters(), lr=0.1)

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run():
4545
epoch_lr[1].append(get_lr(optimizer))
4646

4747
# output = model(...)
48-
# loss = loss_fn(output, ...)
48+
# loss = loss_fn(output, label)
4949
# loss.backward()
5050
optimizer.step()
5151
optimizer.zero_grad()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools>=42"]
2+
requires = ["setuptools>=42.0.0"]
33
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ classifiers =
1313
Intended Audience :: Science/Research
1414
License :: OSI Approved :: MIT License
1515
Operating System :: OS Independent
16-
Programming Language :: Python :: 3
16+
Programming Language :: Python :: 3.6
17+
Programming Language :: Python :: 3.7
18+
Programming Language :: Python :: 3.8
19+
Programming Language :: Python :: 3.9
1720
Topic :: Scientific/Engineering :: Artificial Intelligence
1821

1922

@@ -22,8 +25,8 @@ package_dir =
2225
= src
2326
packages = find:
2427
python_requires = >=3.6
25-
install_requires=
26-
torch >= 1.7.1
28+
# install_requires=
29+
# torch >= 1.1.0
2730

2831

2932
[options.packages.find]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .warmup_module import WarmUpScheduler, VERSION
22

3-
__all__ = ['__version__', 'WarmUpScheduler']
4-
53
__version__ = VERSION
64

5+
__all__ = ['__version__', 'WarmUpScheduler']

src/warmup_scheduler_pytorch/warmup_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"""
55

66
from torch.optim import Optimizer
7-
from torch.optim.lr_scheduler import _LRScheduler # ignore its error
7+
from torch.optim.lr_scheduler import _LRScheduler
88

99
__all__ = ['VERSION', 'WarmUpScheduler']
1010

11-
VERSION = '0.1.0'
11+
VERSION = '0.1.1'
1212

1313

1414
class WarmUpScheduler(object):

tests/test_base.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
from src.warmup_scheduler_pytorch import WarmUpScheduler, __version__
2-
from src.warmup_scheduler_pytorch.warmup_module import VERSION
3-
4-
5-
def test_version():
6-
assert VERSION == __version__
7-
8-
91
def test_import():
10-
assert isinstance(WarmUpScheduler, object)
2+
from src.warmup_scheduler_pytorch import WarmUpScheduler, __version__
3+
from src.warmup_scheduler_pytorch.warmup_module import VERSION

tests/test_warmup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def test_warmup_init(self):
7777
pass
7878

7979
def test_warmup_state_dict(self):
80-
sd = self.warmup_scheduler.state_dict()
81-
self.warmup_scheduler.load_state_dict(sd)
80+
state_dict = self.warmup_scheduler.state_dict()
81+
self.warmup_scheduler.load_state_dict(state_dict)
8282

8383
def test_warmup_get(self):
8484
self.warmup_scheduler.get_last_lr()

0 commit comments

Comments
 (0)