Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.
Avoid being a link dump. Try to provide only valuable well tuned information.
Neural network links before starting with transformers.
| import logo from './logo.svg'; | |
| import './App.css'; | |
| import {useState, useEffect} from "react"; | |
| import * as tf from '@tensorflow/tfjs'; | |
| function App() { | |
| const [result, setResult] = useState(); | |
| const [model,setModel] = useState(); | |
| const [prob, setProb] = useState(); | |
| const c2i = {" ": 0, "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "g": 7, "h": 8, "i": 9, "j": 10, "k": 11, "l": 12, "m": 13, "n": 14, "o": 15, "p": 16, "q": 17, "r": 18, "s": 19, "t": 20, "u": 21, "v": 22, "w": 23, "x": 24, "y": 25, "z": 26}; |
| import tensorflow as tf | |
| model = tf.keras.Sequential([ | |
| tf.keras.layers.Embedding(len(char2id) + 1, 100, input_length=max_len), | |
| tf.keras.layers.Flatten(), | |
| tf.keras.layers.Dense(512, activation='relu'), | |
| tf.keras.layers.Dense(1, activation='sigmoid') | |
| ]) | |
| model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) |
| import re | |
| import numpy as np | |
| c2i = {' ': 0, 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26} | |
| max_len = 10 | |
| def process_text(name): | |
| name = name.lower() | |
| name = re.sub("[^a-z ]", "", name) | |
| name = " ".join([x for x in name.split() if len(x)!=1]) |
| from bst import BST | |
| bst = BST() | |
| values = [2,1,5,44,15] | |
| for x in values: | |
| bst.insert(x) | |
| bst.inorder() |
| from node import Node | |
| class BST: | |
| __root = None | |
| def insert(self, value): | |
| def _insert(root, value): | |
| if root is None: |
| class Node: | |
| __left = None | |
| __right = None | |
| def __init__(self, value) -> None: | |
| super().__init__() | |
| self.__value = value | |
| @property | |
| def value(self): |
| import pickle | |
| class LabelEncoder: | |
| ''' | |
| Utility function to encode labels to keys and vice versa | |
| ''' | |
| def __init__(self,label_list): | |
| self.label_list = list(set(label_list)) | |
| self.map_key = {index:self.label_list[index] for index in range(len(self.label_list))} | |
| self.unmap_key = {self.map_key[idx]:idx for idx in range(len(self.label_list))} |