Skip to content

Commit 6f9f02f

Browse files
committed
Fix readme
1 parent 323e1df commit 6f9f02f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Evaluation - loss: 0.672396 acc: 57.6923%(615/1066)
8484
If you has construct you test set, you make testing like:
8585

8686
```
87-
/main.py -test -snapshot="./snapshot/2017-02-11-15-50/snapshot_steps1500.pt
87+
/main.py -test -snapshot="./snapshot/2017-02-11_15-50-53/snapshot_steps1500.pt
8888
```
8989
The snapshot option means where your model load from. If you don't assign it, the model will start from scratch.
9090

@@ -93,12 +93,12 @@ The snapshot option means where your model load from. If you don't assign it, th
9393

9494
```
9595
./main.py -predict="Hello my dear , I love you so much ." \
96-
-snapshot="./snapshot/2017-02-11-15-50/snapshot_steps1500.pt"
96+
-snapshot="./snapshot/2017-02-11_15-50-53/snapshot_steps1500.pt"
9797
```
9898
You will get:
9999

100100
```
101-
Loading model from [./snapshot/2017-02-11-15-50/snapshot_steps1500.pt]...
101+
Loading model from [./snapshot/2017-02-11_15-50-53/snapshot_steps1500.pt]...
102102

103103
[Text] Hello my dear , I love you so much .
104104
[Label] positive
@@ -107,18 +107,18 @@ The snapshot option means where your model load from. If you don't assign it, th
107107

108108
```
109109
./main.py -predict="You just make me so sad and I have to leave you ."\
110-
-snapshot="./snapshot/2017-02-11-15-50/snapshot_steps1500.pt"
110+
-snapshot="./snapshot/2017-02-11_15-50-53/snapshot_steps1500.pt"
111111
```
112112
You will get:
113113

114114
```
115-
Loading model from [./snapshot/2017-02-11-15-50/snapshot_steps1500.pt]...
115+
Loading model from [./snapshot/2017-02-11_15-50-53/snapshot_steps1500.pt]...
116116

117117
[Text] You just make me so sad and I have to leave you .
118118
[Label] negative
119119
```
120120

121-
Your text must be separated by space, even punctuation.
121+
Your text must be separated by space, even punctuation.And, your text should longer then the max kernel size.
122122

123123
## Reference
124124
* [Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882)

main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
parser.add_argument('-log-interval', type=int, default=1, help='how many steps to wait before logging training status [default: 1]')
1919
parser.add_argument('-test-interval', type=int, default=100, help='how many steps to wait before testing [default: 100]')
2020
parser.add_argument('-save-interval', type=int, default=500, help='how many steps to wait before saving [default:500]')
21-
parser.add_argument('-save-dir', type=str, default='snapshot', help='where to save the checkpoint')
21+
parser.add_argument('-save-dir', type=str, default='snapshot', help='where to save the snapshot')
2222
# data
2323
parser.add_argument('-shuffle', action='store_true', default=False, help='shuffle the data every epoch' )
2424
# model
@@ -68,16 +68,16 @@ def mr(text_field, label_field, **kargs):
6868
print("\nLoading data...")
6969
text_field = data.Field(lower=True)
7070
label_field = data.Field(sequential=False)
71-
#train_iter, dev_iter = mr(text_field, label_field, device=-1, repeat=False)
72-
train_iter, dev_iter, test_iter = sst(text_field, label_field, device=-1, repeat=False)
71+
train_iter, dev_iter = mr(text_field, label_field, device=-1, repeat=False)
72+
#train_iter, dev_iter, test_iter = sst(text_field, label_field, device=-1, repeat=False)
7373

7474

7575
# update args and print
7676
args.embed_num = len(text_field.vocab)
7777
args.class_num = len(label_field.vocab) - 1
7878
args.cuda = args.no_cuda and torch.cuda.is_available(); del args.no_cuda
7979
args.kernel_sizes = [int(k) for k in args.kernel_sizes.split(',')]
80-
args.save_dir = os.path.join(args.save_dir, datetime.datetime.now().strftime('%Y-%m-%d-%H-%M'))
80+
args.save_dir = os.path.join(args.save_dir, datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))
8181

8282
print("\nParameters:")
8383
for attr, value in sorted(args.__dict__.items()):

0 commit comments

Comments
 (0)