This file contains hidden or 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
| #!/bin/bash | |
| # This script will install pytorch, torchvision, torchtext and spacy on nano. | |
| # If you have any of these installed already on your machine, you can skip those. | |
| sudo apt-get -y update | |
| sudo apt-get -y upgrade | |
| #Dependencies | |
| sudo apt-get install python3-setuptools |
This file contains hidden or 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
| import datetime | |
| import time | |
| import asyncio | |
| from concurrent.futures import ThreadPoolExecutor | |
| """ | |
| 当必须等待的时候,可以使用pool | |
| """ | |
| def anything(i): | |
| print(i,datetime.datetime.now()) |
This file contains hidden or 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
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def hello(): | |
| await asyncio.sleep(3) | |
| print('Hello!') | |
| if __name__ == '__main__': | |
| loop.run_until_complete(hello()) | |