-
CTRL + A— Move to the beginning of the line -
CTRL + E— Move to the end of the line -
CTRL + [left arrow]— Move one word backward (on some systems this is ALT + B) -
CTRL + [right arrow]— Move one word forward (on some systems this is ALT + F) -
CTRL + U— (bash) Clear the characters on the line before the current cursor position -
CTRL + U—(zsh) If you're using the zsh, this will clear the entire line -
CTRL + K— Clear the characters on the line after the current cursor position -
ESC + [backspace]— Delete the word in front of the cursor
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
| -- LUA WARNINGS | |
| -- Array starts from index 1 | |
| -- obj.func() is equivalent to obj:func() | |
| -- Loop: | |
| -- for start_, end_ do | |
| -- end | |
| -- Condition: | |
| -- if <condition> then | |
| -- end | |
| -- Function: |
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
| #include <opencv\cv.h> | |
| #include <opencv\highgui.h> | |
| #include <iostream> | |
| #include <string> | |
| #include <cmath> | |
| using namespace std; | |
| // display video from array of frames, using left and right button. | |
| void displayVideo(cv::Mat* frames, cv::Point2i* centralPoints, int numFrame, int FPS, string windowName) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This list contains repositories of libraries and approaches for knowledge graph embeddings, which are vector representations of entities and relations in a multi-relational directed labelled graph. Licensed under CC0.
- 🆕 AmpliGraph (4 algorithms) @ https://github.com/Accenture/AmpliGraph
- Embedding framework (5 algorithms) @ https://github.com/BookmanHan/Embedding
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 numpy as np | |
| import torch | |
| import keras | |
| def pyt_to_keras(pytorch_model, keras_model): | |
| """ | |
| Given a PyTorch model, this method transfers the weight to | |
| a Keras Model (with backend TensorFlow) with the same architecture. | |
| Assumptions: | |
| 1. The corresponding layer names in both the models will be the same |
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
| { | |
| "python": { | |
| "library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)", | |
| "prefix": "print(json.dumps(black_reformat(u", | |
| "postfix": ")))" | |
| }, | |
| "r": { | |
| "library": "library(formatR)\nlibrary(jsonlite)", | |
| "prefix": "cat(toJSON(paste(tidy_source(text=", | |
| "postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))" |
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 top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')): | |
| """ Filter a distribution of logits using top-k and/or nucleus (top-p) filtering | |
| Args: | |
| logits: logits distribution shape (vocabulary size) | |
| top_k >0: keep only top k tokens with highest probability (top-k filtering). | |
| top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering). | |
| Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751) | |
| """ | |
| assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear | |
| top_k = min(top_k, logits.size(-1)) # Safety check |
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
| # Copyright (c) 2019-present, Thomas Wolf. | |
| # All rights reserved. This source code is licensed under the MIT-style license. | |
| """ A very small and self-contained gist to train a GPT-2 transformer model on wikitext-103 """ | |
| import os | |
| from collections import namedtuple | |
| from tqdm import tqdm | |
| import torch | |
| import torch.nn as nn | |
| from torch.utils.data import DataLoader | |
| from ignite.engine import Engine, Events |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer