Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #1

Merged
merged 155 commits into from
Feb 27, 2018
Merged
Changes from 1 commit
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
9108041
updates for torchtext and loading from snapshot
bmccann Feb 7, 2017
f6770fa
removing default snapshot and setting cuda to avoid pytroch issue 689
bmccann Feb 7, 2017
ec4802c
Update main.py (#68)
eriche2016 Feb 16, 2017
190f8fa
Prevent 2 forward passes with detach
Kaixhin Feb 16, 2017
2ff9485
Add instruction to use specified GPU id (#73)
wkentaro Feb 21, 2017
741e260
Initial checkin
adamlerer Jan 18, 2017
7b2dd86
add data text files
adamlerer Jan 18, 2017
9b33dcf
OpenNMT example now updated and training
bmccann Jan 18, 2017
d88d377
cleanup train.py
adamlerer Jan 18, 2017
b95b4c3
Remove language features leftovers
adamlerer Jan 19, 2017
301b0cb
train from checkpoint
adamlerer Jan 19, 2017
fc52742
final cleanup
adamlerer Jan 19, 2017
ebd985d
params should not be reinitialized for loaded models
bmccann Feb 16, 2017
fa7e589
moving param init
bmccann Feb 16, 2017
f3a883c
start_epoch should increment from saved epoch
bmccann Feb 16, 2017
6be19f9
fixed divide by zero error
atgambardella Feb 23, 2017
c84f7df
[onmt] Update README with models; move data to AWS
adamlerer Feb 22, 2017
f485f7b
multi-gpu via DataParallel
bmccann Feb 1, 2017
0dee89a
allowing the option of single device
bmccann Feb 2, 2017
fcc2ab1
altering translate to be compatible with nn.DataParallel
bmccann Feb 9, 2017
1d0d15d
should not re-init params on load from chkpt
bmccann Feb 9, 2017
a742fe2
friendlier gpu options in translate
bmccann Feb 9, 2017
b840cad
update translate.py gpu option
bmccann Feb 11, 2017
1c16b6c
remove unused lines (#84)
iamaziz Feb 24, 2017
409a726
add flush to print (#81)
fyu Feb 24, 2017
e8d5bbd
Command Line Interface backwards compatible fix for models.py (#85)
cuevasclemente Feb 25, 2017
c39a889
add lmdb to requirements of dcgan. Add instructions to download LSUN …
alykhantejani Mar 2, 2017
130afec
Revert "add flush to print" (#92)
colesbury Mar 2, 2017
179fb76
Fix typo in logging of ImageNet model loading
Maratyszcza Mar 2, 2017
0940311
Replace clip_gradient with torch's newly included clip_grad_norm (fix…
Smerity Mar 3, 2017
e83370b
fix for master
soumith Mar 5, 2017
0598cff
fixes for master
soumith Mar 5, 2017
36b14bb
Change the calculation method of the match number. Since if dataset n…
fuzihaofzh Mar 6, 2017
bcea1f5
PTB LM example now has far better perplexity for both large (72.30) a…
Smerity Mar 10, 2017
aecda28
update attribution of weight tying in word_language_model (#109)
Mar 13, 2017
59f3bb0
translate bug fix
bmccann Feb 24, 2017
fa70523
README changes for multi-gpu
bmccann Feb 24, 2017
a81593a
removing reinit of checkpoint params again
bmccann Feb 24, 2017
4d137ed
using split instead of chunk
bmccann Feb 24, 2017
90fa16a
replacing opt.cuda with opt.gpus as needed
bmccann Feb 24, 2017
cae6d71
using ModuleList
bmccann Feb 24, 2017
cc0ea01
default type for start_decay_at
bmccann Feb 24, 2017
55c92a8
decoder hidden state fix
bmccann Feb 28, 2017
f5f63fb
nn.clip_grad_norm
bmccann Mar 1, 2017
b9235a7
adding src/tgt tokens/s
bmccann Mar 1, 2017
ac610f8
index in verbose translate was fixed
bmccann Mar 1, 2017
720f292
bug in total num predicted words
bmccann Mar 1, 2017
65831db
Variables in Translator can be volatile
bmccann Mar 1, 2017
e426bce
removing unnecessary def
bmccann Mar 2, 2017
dcbe205
allowing lowercase option
bmccann Mar 2, 2017
1b84cff
pointing out one way to do bleu scores in README
bmccann Mar 2, 2017
60960c6
adding files to ignore
bmccann Mar 2, 2017
db92469
preprocess needs to use lower option
bmccann Mar 2, 2017
b0dad45
tips for non-demo mt via flickr30k example
bmccann Mar 2, 2017
7946cf2
cleaning up readme
bmccann Mar 2, 2017
e803cb2
clean up the readme
bmccann Mar 2, 2017
4a11dd7
spacing in readme
bmccann Mar 2, 2017
bf82a7b
cudnn decoder
bmccann Mar 2, 2017
c90842c
reverting cudnn decoder to lstmcell
bmccann Mar 2, 2017
0c634a1
new DataParallel allows dim 1; remove unnecessary transposes; add tra…
bmccann Mar 3, 2017
d1a14ed
mend
bmccann Mar 3, 2017
1100ff5
allows use of models trained on dataset to be trained on another; doe…
bmccann Mar 3, 2017
9913e4c
manual unrolling was broken for brnn; patch until varlen rnn replacement
bmccann Mar 3, 2017
8ea8929
allowing learning rate update for non-sgd optimizers
bmccann Mar 6, 2017
fd87818
adding option to shuffle mini-batches
bmccann Mar 6, 2017
99231ac
adding word level accuracy as a metric
bmccann Mar 6, 2017
1649caf
touch ups and README updates
bmccann Mar 7, 2017
7ececef
allowing validation data to volatile
bmccann Mar 9, 2017
1200378
num_batches was off by one
bmccann Mar 9, 2017
4214691
batch printing was off
bmccann Mar 9, 2017
39bb701
curriculum off by one
bmccann Mar 9, 2017
0e77a0b
accuracy now an average over log_interval batches
bmccann Mar 9, 2017
8bb7c5a
off by one in printing batch number
bmccann Mar 9, 2017
f23ed44
removing unused variables
bmccann Mar 9, 2017
4af62f9
saving with state_dict
bmccann Mar 10, 2017
988ee51
state_dicts for translation and optimizer
bmccann Mar 10, 2017
94ebdc8
Grouping bash commands together
bmccann Mar 10, 2017
fcaf4c2
backwards compatibility for checkpoints
bmccann Mar 14, 2017
bde9f82
one more lowercase in dict
bmccann Mar 14, 2017
42e5b99
Simple typo fix to the download script
HiiYL Mar 17, 2017
b8cacb0
Switch the model to evaluation mode before generation
Henderake Mar 19, 2017
a60bd4e
Fix random seeding in DCGAN (#108)
DmitryUlyanov Mar 20, 2017
63e06c2
move OpenNMT
soumith Mar 21, 2017
e2f885d
remove OpenNMT and link to elsewhere
soumith Mar 21, 2017
f931931
Remove rectifier before softmax (#117)
dmitriy-serdyuk Mar 21, 2017
eee4bb8
some wrong typing (#125)
tsingcoo Mar 27, 2017
91c4f3e
update formatting in README
alykhantejani Mar 28, 2017
75e435f
apply normalization for output image of dcgan generator (#127)
fehiepsi Mar 28, 2017
c4b48c4
lr floating division
soumith Mar 29, 2017
18df41e
fix direct access to subsections
edgarriba Mar 31, 2017
f2a771a
Handle tied + dimensions mismatch (#124)
nadavbh12 Apr 3, 2017
0bdcb42
Fix highlighted headers in readme (#122)
edgarriba Apr 5, 2017
f89a371
fix a bug in DCGAN (#121)
huqinghao Apr 5, 2017
ac5b745
fix dcgan
soumith Apr 5, 2017
7c57e52
Add a time sequence prediction example (#118)
fuzihaofzh Apr 5, 2017
046abef
Update README.md
soumith Apr 5, 2017
50afe29
open without 'rb' caused Python 3 to open this in text mode and fail …
dnouri Apr 7, 2017
28471f2
Fix typo in imagenet/main.py (#135)
joaqo Apr 8, 2017
3f21078
Changes in `reinforce.py` (#140)
zuoxingdong Apr 11, 2017
0984955
save/load optimizer state (#141)
aromnvidia Apr 12, 2017
2f7b7ad
snli/model.py: can run using Python 2.* (#145)
donglixp Apr 18, 2017
140a8bf
Fix help message for no-cuda (#153)
jucor Apr 26, 2017
89facbe
replace model by policy (#154)
quanvuong May 2, 2017
5c41070
mnist_hogwild manual breaking of gradient sharing removed (#138)
pfrendl May 19, 2017
dc10cd8
fast-neural-style example (#129)
abhiskk Jun 6, 2017
1c6d9d2
Change reusing of Variables (#150)
bartolsthoorn Jun 6, 2017
300ae6b
parameter in test() function is useless
chao1224 Jul 6, 2017
3aca2d7
fix test() param, and fix bugs in nll_loss
chao1224 Jul 6, 2017
3b60784
add comments
chao1224 Jul 6, 2017
d610b4a
remove useless line
chao1224 Jul 6, 2017
53f25e0
unuse average over batch
chao1224 Jul 6, 2017
d6e6324
added comments in snli/train.py, no code changes (#177)
andreh7 Jul 6, 2017
cab5705
Bugs In MNIST (#175)
apaszke Jul 7, 2017
1b26501
fix bugs in generalization error calculation (#179)
chao1224 Jul 7, 2017
2d0f1c4
added a function makedirs() which works both for python 2 and 3 (#176)
andreh7 Jul 13, 2017
08be28e
This PR fixes error raised during element-wise variable division. (#182)
twairball Jul 20, 2017
10b22dc
Fix test_epoch typo (#183)
boscotsang Jul 20, 2017
a4e6972
Fix test data in time_sequence_prediction (#186)
PeterChe1990 Jul 21, 2017
6b17f79
README: Correct case and add link to PyTorch (#188)
kenfehling Jul 23, 2017
d165984
Use nn.init from core to init SR example (#189)
Kaixhin Jul 23, 2017
0722b2f
Remove unused imports in SR example (#190)
Kaixhin Jul 23, 2017
b0a116e
Add an option to perform distributed ImageNet training (#185)
apaszke Jul 28, 2017
5c2b513
Change "gain" -> "calculate_gain" (#192)
Kaixhin Aug 2, 2017
9012fae
fix for 0.2
soumith Jul 20, 2017
9053040
fix for 0.2
soumith Jul 20, 2017
fb9ca4d
mnist 0.2 fixes
soumith Jul 20, 2017
86bc3e5
Add model_names back. Fixes #195
desimone Aug 8, 2017
2dca104
reinforcement_learning fix reward threshold
Aug 14, 2017
930ae27
Change test DataLoader to use the test batch size
rdinse Sep 5, 2017
407bd3e
minor spelling, evaluted->evaluated
brettkoonce Sep 15, 2017
a723598
change lr to 0.8 to fix the issue for 0.2
boathit Sep 21, 2017
30b9c0e
Update README.md (#219)
saikrishna-1996 Sep 21, 2017
3648cbc
vae: Fix `UserWarning` (#220)
r9y9 Sep 22, 2017
ddf9e30
h rather than c should be fed into the next layer of LSTM (#222)
dtolpin Sep 25, 2017
ab7cb38
Balance VAE losses, add reconstruction + sampling
Kaixhin Oct 1, 2017
5f24730
Add support for CUDA
Kaixhin Oct 1, 2017
9fe431e
Fix VAE loss + improve reconstruction viz
Kaixhin Oct 1, 2017
aa7adf0
Remove unused math import
Kaixhin Oct 1, 2017
7d0d413
Add link to script for preparing imagenet val data
achalddave Oct 6, 2017
9a02f2a
Fix an argument instruction in mnist_hogwild
chengs Oct 25, 2017
23f8abf
bug fix: vocab.load_vectors signature update
sivareddyg Oct 22, 2017
7532a61
Document the data arrangement in word_language_model
Oct 26, 2017
fad7759
Consistent newlines
Oct 26, 2017
62d5ca5
Add linear layer to time series prediction
t-vi Nov 9, 2017
cf74c81
Swap PTB for Wikitext-2 (which is open access)
adamlerer Nov 24, 2017
e0d33a6
Scale -> Resize + RandomSizedCrop -> RandomResizedCrop
alykhantejani Oct 1, 2017
9faf2c6
Update RL examples to use torch.distributions instead of reinforce
Kaixhin Nov 4, 2017
82cef44
Fix action indexing
Kaixhin Nov 7, 2017
ca90734
Fix bugs and improve performance
colesbury Nov 14, 2017
d5678bc
Replace WikiText-2 files with correct dataset (#264)
Smerity Dec 5, 2017
e23a9b4
fix: `Multinomial` is now `Categorical`
blin00 Dec 8, 2017
e11e079
Fix indentation to be self-consistent (#279)
JustinShenk Jan 6, 2018
8256aee
Fix UserWarning in two examples (#293)
lwneal Jan 29, 2018
963f7d1
Fix VAE losses (sum over everything) (#296)
Kaixhin Feb 2, 2018
4ef2d4d
Fix actor_critic example (#301)
colesbury Feb 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allowing the option of single device
  • Loading branch information
bmccann authored and soumith committed Feb 23, 2017
commit 0dee89afb0a79054aabc2c3e9a3cff06f580210a
14 changes: 8 additions & 6 deletions OpenNMT/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
See README for specific formatting instructions.""")

# GPU
parser.add_argument('-gpu', default=[], nargs='+', type=int,
parser.add_argument('-gpus', default=[], nargs='+', type=int,
help="Use CUDA")

parser.add_argument('-log_interval', type=int, default=50,
Expand All @@ -96,15 +96,15 @@
# help="Seed for random initialization")

opt = parser.parse_args()
opt.cuda = len(opt.gpu)
opt.cuda = len(opt.gpus)

print(opt)

if torch.cuda.is_available() and not opt.cuda:
print("WARNING: You have a CUDA device, so you should probably run with -cuda")

if opt.cuda:
cuda.set_device(opt.gpu[0])
cuda.set_device(opt.gpus[0])

def NMTCriterion(vocabSize):
weight = torch.ones(vocabSize)
Expand All @@ -118,7 +118,7 @@ def NMTCriterion(vocabSize):
def memoryEfficientLoss(outputs, targets, generator, crit, eval=False):
# compute generations one piece at a time
loss = 0
outputs = Variable(outputs.data, requires_grad=(not eval), volatile=eval)
outputs = Variable(outputs.data, requires_grad=(not eval), volatile=eval).contiguous()

batch_size = outputs.size(1)
outputs_split = torch.split(outputs, opt.max_generator_batches)
Expand Down Expand Up @@ -257,9 +257,11 @@ def main():
generator = nn.Sequential(
nn.Linear(opt.rnn_size, dicts['tgt'].size()),
nn.LogSoftmax())
generator = nn.DataParallel(generator, device_ids=opt.gpu)
if opt.cuda > 1:
generator = nn.DataParallel(generator, device_ids=opt.gpus)
model = onmt.Models.NMTModel(encoder, decoder, generator)
model = nn.DataParallel(model, device_ids=opt.gpu)
if opt.cuda > 1:
model = nn.DataParallel(model, device_ids=opt.gpus)
if opt.cuda:
model.cuda()
else:
Expand Down