Created
July 12, 2019 16:43
-
-
Save vv111y/fa6f15ee838c4f70ee9925f388afa2b9 to your computer and use it in GitHub Desktop.
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
| [Trace - 12:41:21 PM] Sending request 'initialize - (3489)'. | |
| Params: { | |
| "processId": 6514, | |
| "rootPath": "/home/will/", | |
| "rootUri": "file:///home/will/", | |
| "capabilities": { | |
| "workspace": { | |
| "workspaceEdit": { | |
| "documentChanges": true, | |
| "resourceOperations": [ | |
| "create", | |
| "rename", | |
| "delete" | |
| ] | |
| }, | |
| "applyEdit": true, | |
| "symbol": { | |
| "symbolKind": { | |
| "valueSet": [ | |
| 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 | |
| ] | |
| } | |
| }, | |
| "executeCommand": { | |
| "dynamicRegistration": false | |
| }, | |
| "didChangeWatchedFiles": { | |
| "dynamicRegistration": true | |
| }, | |
| "workspaceFolders": true, | |
| "configuration": true | |
| }, | |
| "textDocument": { | |
| "declaration": { | |
| "linkSupport": true | |
| }, | |
| "definition": { | |
| "linkSupport": true | |
| }, | |
| "implementation": { | |
| "linkSupport": true | |
| }, | |
| "typeDefinition": { | |
| "linkSupport": true | |
| }, | |
| "synchronization": { | |
| "willSave": true, | |
| "didSave": true, | |
| "willSaveWaitUntil": true | |
| }, | |
| "documentSymbol": { | |
| "symbolKind": { | |
| "valueSet": [ | |
| 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 | |
| ] | |
| }, | |
| "hierarchicalDocumentSymbolSupport": true | |
| }, | |
| "formatting": { | |
| "dynamicRegistration": true | |
| }, | |
| "codeAction": { | |
| "dynamicRegistration": true, | |
| "codeActionLiteralSupport": { | |
| "codeActionKind": { | |
| "valueSet": [ | |
| "", | |
| "quickfix", | |
| "refactor", | |
| "refactor.extract", | |
| "refactor.inline", | |
| "refactor.rewrite", | |
| "source", | |
| "source.organizeImports" | |
| ] | |
| } | |
| } | |
| }, | |
| "completion": { | |
| "completionItem": { | |
| "snippetSupport": true, | |
| "documentationFormat": [ | |
| "markdown" | |
| ] | |
| }, | |
| "contextSupport": true | |
| }, | |
| "signatureHelp": { | |
| "signatureInformation": { | |
| "parameterInformation": { | |
| "labelOffsetSupport": true | |
| } | |
| } | |
| }, | |
| "documentLink": { | |
| "dynamicRegistration": true | |
| }, | |
| "hover": { | |
| "contentFormat": [ | |
| "markdown", | |
| "plaintext" | |
| ] | |
| }, | |
| "foldingRange": { | |
| "dynamicRegistration": true, | |
| "rangeLimit": null, | |
| "lineFoldingOnly": null | |
| } | |
| } | |
| }, | |
| "initializationOptions": { | |
| "interpreter": { | |
| "properties": { | |
| "InterpreterPath": "/home/will/anaconda3/envs/main/bin/python", | |
| "Version": "3.6" | |
| } | |
| }, | |
| "displayOptions": { | |
| "preferredFormat": "markdown", | |
| "trimDocumentationLines": false, | |
| "maxDocumentationLineLength": 0, | |
| "trimDocumentationText": false, | |
| "maxDocumentationTextLength": 0 | |
| }, | |
| "searchPaths": [], | |
| "analysisUpdates": true, | |
| "asyncStartup": true, | |
| "typeStubSearchPaths": [ | |
| "/home/will/.local/python-language-server/output/bin/Release/Typeshed" | |
| ] | |
| } | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "Analysis cache path: /home/will/.cache/Microsoft/Python Language Server", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "GetCurrentSearchPaths /home/will/anaconda3/envs/main/bin/python ", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "Interpreter search paths:", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": " /home/will/anaconda3/envs/main/lib/python3.6", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": " /home/will/anaconda3/envs/main/lib/python3.6/lib-dynload", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": " /home/will/anaconda3/envs/main/lib/python3.6/site-packages", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "User search paths:", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": " /home/will/DevAcademics/ReinforcementLearning/spinningup", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": " /home/will/DevWorkspace/gpu-sentry", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:22 PM] Received notification 'python/beginProgress'. | |
| Params: [] | |
| [Trace - 12:41:22 PM] Received notification 'python/reportProgress'. | |
| Params: [ | |
| "Analyzing in background, 1 items left..." | |
| ] | |
| [Trace - 12:41:22 PM] Received notification 'python/endProgress'. | |
| Params: [] | |
| [Trace - 12:41:35 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "Microsoft Python Language Server version 1.0.0.0", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:35 PM] Received notification 'window/logMessage'. | |
| Params: { | |
| "message": "Initializing for /home/will/anaconda3/envs/main/bin/python", | |
| "type": 3 | |
| } | |
| [Trace - 12:41:35 PM] Received response 'initialize - (3489)' in 210ms. | |
| Result: { | |
| "capabilities": { | |
| "renameProvider": true, | |
| "documentOnTypeFormattingProvider": { | |
| "moreTriggerCharacter": [ | |
| ";", | |
| ":" | |
| ], | |
| "firstTriggerCharacter": "\n" | |
| }, | |
| "documentRangeFormattingProvider": null, | |
| "documentFormattingProvider": null, | |
| "codeActionProvider": null, | |
| "workspaceSymbolProvider": true, | |
| "documentSymbolProvider": true, | |
| "documentHighlightProvider": null, | |
| "referencesProvider": true, | |
| "definitionProvider": true, | |
| "signatureHelpProvider": { | |
| "triggerCharacters": [ | |
| "(", | |
| ",", | |
| ")" | |
| ] | |
| }, | |
| "completionProvider": { | |
| "triggerCharacters": [ | |
| "." | |
| ], | |
| "resolveProvider": null | |
| }, | |
| "hoverProvider": true, | |
| "textDocumentSync": { | |
| "willSaveWaitUntil": null, | |
| "willSave": null, | |
| "change": 2, | |
| "openClose": true | |
| } | |
| } | |
| } | |
| [Trace - 12:41:35 PM] Sending notification 'initialized'. | |
| Params: { | |
| } | |
| [Trace - 12:41:35 PM] Sending notification 'workspace/didChangeConfiguration'. | |
| Params: { | |
| "settings": { | |
| "python": { | |
| "analysis": { | |
| "warnings": [ | |
| "unresolved-import", | |
| "parameter-already-specified", | |
| "too-many-positional-arguments-before-star" | |
| ], | |
| "errors": [ | |
| "unknown-parameter-name", | |
| "undefined-variable", | |
| "parameter-missing", | |
| "positional-argument-after-keyword", | |
| "too-many-function-arguments" | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| [Trace - 12:41:35 PM] Sending notification 'textDocument/didOpen'. | |
| Params: { | |
| "textDocument": { | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py", | |
| "languageId": "python", | |
| "version": 0, | |
| "text": "import torch\nfrom Batch import nopeak_mask\nimport torch.nn.functional as F\nimport math\n\n\ndef init_vars(src, model, SRC, TRG, opt):\n\n init_tok = TRG.vocab.stoi['<sos>']\n src_mask = (src != SRC.vocab.stoi['<pad>']).unsqueeze(-2)\n e_output = model.encoder(src, src_mask)\n\n outputs = torch.LongTensor([[init_tok]])\n if opt.device.type == 'cuda':\n outputs = outputs.cuda()\n\n trg_mask = nopeak_mask(1, opt)\n\n out = model.out(model.decoder(outputs,\n e_output, src_mask, trg_mask))\n out = F.softmax(out, dim=-1)\n\n probs, ix = out[:, -1].data.topk(opt.k)\n log_scores = torch.Tensor([math.log(prob) for prob in probs.data[0]]).unsqueeze(0)\n\n outputs = torch.zeros(opt.k, opt.max_len).long()\n if opt.device.type == 'cuda':\n outputs = outputs.cuda()\n outputs[:, 0] = init_tok\n outputs[:, 1] = ix[0]\n\n e_outputs = torch.zeros(opt.k, e_output.size(-2),e_output.size(-1))\n if opt.device.type == 'cuda':\n e_outputs = e_outputs.cuda()\n e_outputs[:, :] = e_output[0]\n\n return outputs, e_outputs, log_scores\n\ndef k_best_outputs(outputs, out, log_scores, i, k):\n\n probs, ix = out[:, -1].data.topk(k)\n log_probs = torch.Tensor([math.log(p) for p in probs.data.view(-1)]).view(k, -1) + log_scores.transpose(0,1)\n k_probs, k_ix = log_probs.view(-1).topk(k)\n\n row = k_ix // k\n col = k_ix % k\n\n outputs[:, :i] = outputs[row, :i]\n outputs[:, i] = ix[row, col]\n\n log_scores = k_probs.unsqueeze(0)\n\n return outputs, log_scores\n\ndef beam_search(src, model, SRC, TRG, opt):\n\n\n outputs, e_outputs, log_scores = init_vars(src, model, SRC, TRG, opt)\n eos_tok = TRG.vocab.stoi['<eos>']\n src_mask = (src != SRC.vocab.stoi['<pad>']).unsqueeze(-2)\n ind = None\n for i in range(2, opt.max_len):\n\n trg_mask = nopeak_mask(i, opt)\n\n out = model.out(model.decoder(outputs[:,:i],\n e_outputs, src_mask, trg_mask))\n\n out = F.softmax(out, dim=-1)\n\n outputs, log_scores = k_best_outputs(outputs, out, log_scores, i, opt.k)\n\n if (outputs==eos_tok).nonzero().size(0) == opt.k:\n alpha = 0.7\n div = 1/((outputs==eos_tok).nonzero()[:,1].type_as(log_scores)**alpha)\n _, ind = torch.max(log_scores * div, 1)\n ind = ind.data[0]\n break\n\n if ind is None:\n length = (outputs[0]==eos_tok).nonzero()[0]\n return ' '.join([TRG.vocab.itos[tok] for tok in outputs[0][1:length]])\n\n else:\n length = (outputs[ind]==eos_tok).nonzero()[0]\n return ' '.join([TRG.vocab.itos[tok] for tok in outputs[ind][1:length]])\n" | |
| } | |
| } | |
| [Trace - 12:41:35 PM] Received notification 'python/languageServerStarted'. | |
| Params: [] | |
| [Trace - 12:41:36 PM] Received notification 'python/beginProgress'. | |
| Params: [] | |
| [Trace - 12:41:36 PM] Received notification 'python/reportProgress'. | |
| Params: [ | |
| "Analyzing in background, 154 items left..." | |
| ] | |
| [Trace - 12:41:36 PM] Received notification 'python/reportProgress'. | |
| Params: [ | |
| "Analyzing in background, 182 items left..." | |
| ] | |
| [Trace - 12:41:37 PM] Received notification 'textDocument/publishDiagnostics'. | |
| Params: { | |
| "diagnostics": [ | |
| { | |
| "message": "unresolved import 'Batch'", | |
| "source": "Python", | |
| "code": "unresolved-import", | |
| "severity": 2, | |
| "range": { | |
| "end": { | |
| "character": 10, | |
| "line": 1 | |
| }, | |
| "start": { | |
| "character": 5, | |
| "line": 1 | |
| } | |
| } | |
| }, | |
| { | |
| "message": "Undefined variable: 'nopeak_mask'", | |
| "source": "Python", | |
| "code": "undefined-variable", | |
| "severity": 1, | |
| "range": { | |
| "end": { | |
| "character": 26, | |
| "line": 16 | |
| }, | |
| "start": { | |
| "character": 15, | |
| "line": 16 | |
| } | |
| } | |
| }, | |
| { | |
| "message": "Undefined variable: 'nopeak_mask'", | |
| "source": "Python", | |
| "code": "undefined-variable", | |
| "severity": 1, | |
| "range": { | |
| "end": { | |
| "character": 30, | |
| "line": 63 | |
| }, | |
| "start": { | |
| "character": 19, | |
| "line": 63 | |
| } | |
| } | |
| } | |
| ], | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py" | |
| } | |
| [Trace - 12:41:37 PM] Sending request 'textDocument/hover - (3490)'. | |
| Params: { | |
| "textDocument": { | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py" | |
| }, | |
| "position": { | |
| "line": 32, | |
| "character": 4 | |
| } | |
| } | |
| [Trace - 12:41:37 PM] Sending request 'textDocument/hover - (3491)'. | |
| Params: { | |
| "textDocument": { | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py" | |
| }, | |
| "position": { | |
| "line": 32, | |
| "character": 7 | |
| } | |
| } | |
| [Trace - 12:41:37 PM] Sending request 'textDocument/hover - (3492)'. | |
| Params: { | |
| "textDocument": { | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py" | |
| }, | |
| "position": { | |
| "line": 32, | |
| "character": 11 | |
| } | |
| } | |
| [Trace - 12:41:37 PM] Sending request 'textDocument/hover - (3493)'. | |
| Params: { | |
| "textDocument": { | |
| "uri": "file:///home/will/DevAcademics/NLP/AISC-Workshop/asgn2+3/Transformer/Beam.py" | |
| }, | |
| "position": { | |
| "line": 32, | |
| "character": 18 | |
| } | |
| } | |
| [Trace - 12:41:39 PM] Received notification 'python/reportProgress'. | |
| Params: [ | |
| "Analyzing in background, 751 items left..." | |
| ] | |
| [Trace - 12:41:39 PM] Received notification 'telemetry/event'. | |
| Params: { | |
| "Measurements": { | |
| "elapsedMs": 277.0555 | |
| }, | |
| "Properties": { | |
| "plsVersion": "1.0.0.0", | |
| "method": "textDocument/hover" | |
| }, | |
| "EventName": "python_language_server/rpc.request" | |
| } | |
| [Trace - 12:41:39 PM] Received notification 'telemetry/event'. | |
| Params: { | |
| "Measurements": { | |
| "elapsedMs": 275.2643 | |
| }, | |
| "Properties": { | |
| "plsVersion": "1.0.0.0", | |
| "method": "textDocument/hover" | |
| }, | |
| "EventName": "python_language_server/rpc.request" | |
| } | |
| [Trace - 12:41:39 PM] Received notification 'telemetry/event'. | |
| Params: { | |
| "Measurements": { | |
| "elapsedMs": 276.8931 | |
| }, | |
| "Properties": { | |
| "plsVersion": "1.0.0.0", | |
| "method": "textDocument/hover" | |
| }, | |
| "EventName": "python_language_server/rpc.request" | |
| } | |
| [Trace - 12:41:39 PM] Received response 'textDocument/hover - (3493)' in 132ms. | |
| Result: null | |
| [Trace - 12:41:39 PM] Received response 'textDocument/hover - (3491)' in 138ms. | |
| Result: null | |
| [Trace - 12:41:39 PM] Received notification 'telemetry/event'. | |
| Params: { | |
| "Measurements": { | |
| "elapsedMs": 406.8399 | |
| }, | |
| "Properties": { | |
| "plsVersion": "1.0.0.0", | |
| "method": "textDocument/hover" | |
| }, | |
| "EventName": "python_language_server/rpc.request" | |
| } | |
| [Trace - 12:41:39 PM] Received response 'textDocument/hover - (3490)' in 142ms. | |
| Result: null | |
| [Trace - 12:41:39 PM] Received response 'textDocument/hover - (3492)' in 137ms. | |
| Result: null | |
| [Trace - 12:41:40 PM] Sending request 'shutdown - (3494)'. | |
| Params: null | |
| [Trace - 12:41:40 PM] Sending notification 'exit'. | |
| Params: null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment