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
| class DistributedIdentity: | |
| """ | |
| Singleton class to hold distributed identity information. | |
| Handles SLURM, torchrun, and local runs. | |
| Looks for the following environment variables: | |
| - RANK | |
| - WORLD_SIZE | |
| - LOCAL_RANK |
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 torch | |
| import torch.nn as nn | |
| class Sparsemax(nn.Module): | |
| def __init__(self, dim=-1): | |
| super(Sparsemax, self).__init__() | |
| self.dim = dim | |
| def forward(self, x): | |
| # Move the dimension to apply Sparsemax to the front |
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
| setup=''' | |
| import numpy as np | |
| import torch | |
| V_nat = [[1, 2], [3, 4]] | |
| U_nat = [[2, -1, 0, 0, 0, 0], | |
| [5, 2, 8, -1, 0, 0]] | |
| def compute_using_fleuret_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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
NewerOlder