forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Usability improvement bi lstm sort (apache#8944)
* Improve usability for the bilstm example * Remove argparse from infer_sort since it changes existing usage
- Loading branch information
1 parent
d2d3d6a
commit c0bfb71
Showing
6 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
This is an example of using bidirection lstm to sort an array. | ||
|
||
Firstly, generate data by: | ||
|
||
python gen_data.py | ||
|
||
Move generated txt files to data directory | ||
|
||
mkdir data | ||
mv *.txt data | ||
|
||
Then, train the model by: | ||
|
||
python lstm_sort.py | ||
|
||
At last, test model by: | ||
|
||
python infer_sort.py 234 189 785 763 231 | ||
|
||
and will output sorted seq | ||
|
||
189 | ||
231 | ||
234 | ||
763 | ||
785 | ||
|
||
|
||
Run the training script by doing the following: | ||
|
||
``` | ||
python lstm_sort.py --start-range 100 --end-range 1000 --cpu | ||
``` | ||
You can provide the start-range and end-range for the numbers and whether to train on the cpu or not. | ||
By default the script tries to train on the GPU. The default start-range is 100 and end-range is 1000. | ||
|
||
At last, test model by doing the following: | ||
|
||
``` | ||
python infer_sort.py 234 189 785 763 231 | ||
``` | ||
|
||
This should output the sorted seq like the following: | ||
``` | ||
189 | ||
231 | ||
234 | ||
763 | ||
785 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters