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
| def train(dataloader, model, optimizer, device, scheduler=None): | |
| # scaler -> an instance of the GradScaler object | |
| scaler = amp.GradScaler() | |
| model.train() | |
| for batch_idx, d in enumerate(dataloader): | |
| ids = d['ids'] | |
| token_type_ids = d['token_type_ids'] | |
| mask = d['mask'] | |
| targets = d['targets'] |
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
| pytorch torchvision cudatoolkit=10.1 -c pytorch-nightly |
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
| !wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh | |
| !chmod +x Miniconda3-4.5.4-Linux-x86_64.sh | |
| !bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local | |
| # update 1 | |
| !conda install -q -y --prefix /usr/local python=3.6 pytorch torchvision cudatoolkit=10.1 -c pytorch-nightly | |
| # update 2 | |
| import sys | |
| sys.path.append('/usr/local/lib/python3.6/site-packages') |
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
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| val rollButton: Button = findViewById(R.id.roll_button) | |
| diceImage = findViewById(R.id.dice_image) | |
| rollButton.setOnClickListener { | |
| rollDice() | |
| } | |
| } |
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
| # Query function | |
| def query(db): | |
| return db.sum() | |
| full_db_result = query(db) | |
| sensitivity = 0 | |
| for pdb in pdbs: | |
| pdb_result = query(pdb) | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 102 columns, instead of 53 in line 1.
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
| 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102 | |
| pink primrose,hard-leaved pocket orchid,canterbury bells,sweet pea,english marigold,tiger lily,moon orchid,bird of paradise,monkshood,globe thistle,snapdragon,colt's foot,king protea,spear thistle,yellow iris,globe-flower,purple coneflower,peruvian lily,balloon flower,giant white arum lily,fire lily,pincushion flower,fritillary,red ginger,grape hyacinth,corn poppy,prince of wales feathers,stemless gentian,artichoke,sweet william,carnation,garden phlox,love in the mist,mexican aster,alpine sea holly,ruby-lipped cattleya,cape flower,great masterwort,siam tulip,lenten rose,barbeton daisy,daffodil,sword lily,poinsettia,bolero deep blue,wallflower,marigold,buttercup,oxeye daisy,common dandelion,petunia,wild pansy,primul |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 102 columns, instead of 53 in line 1.
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
| 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102 | |
| pink primrose,hard-leaved pocket orchid,canterbury bells,sweet pea,english marigold,tiger lily,moon orchid,bird of paradise,monkshood,globe thistle,snapdragon,colt's foot,king protea,spear thistle,yellow iris,globe-flower,purple coneflower,peruvian lily,balloon flower,giant white arum lily,fire lily,pincushion flower,fritillary,red ginger,grape hyacinth,corn poppy,prince of wales feathers,stemless gentian,artichoke,sweet william,carnation,garden phlox,love in the mist,mexican aster,alpine sea holly,ruby-lipped cattleya,cape flower,great masterwort,siam tulip,lenten rose,barbeton daisy,daffodil,sword lily,poinsettia,bolero deep blue,wallflower,marigold,buttercup,oxeye daisy,common dandelion,petunia,wild pansy,primul |
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
| # model: | |
| model = YourModelHere() | |
| # params you need to specify: | |
| epochs = 5 | |
| train_loader, val_loader = # put your data loader here | |
| loss_function = nn.CrossEntropyLoss() # your loss function, cross entropy works well for multi-class problems | |
| # optimizer, I've used Adadelta, as it wokrs well without any magic numbers | |
| optimizer = optim.Adadelta(model.parameters()) |
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
| ds.owner | |
| <VirtualWorker id:me #tensors:0> | |
| # get the objects from remote machine | |
| remote_ds.get() | |
| tensor([1, 2, 3, 4, 5, 6, 7, 8, 9]) |
NewerOlder