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
| #/usr/bin/python | |
| import sys | |
| import json | |
| # open grid file | |
| with open(sys.argv[1]) as f: | |
| lines = [line.rstrip('\n') for line in f] | |
| # make the grid but padded on left right and bottom sides with a sentinel like this (makes it easy to grab diagonals) |
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
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
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
| # Imports | |
| from ibm_watsonx_ai.foundation_models import ModelInference | |
| from ibm_watsonx_ai.metanames import GenTextParamsMetaNames as GenParams | |
| from ibm_watsonx_ai.metanames import EmbedTextParamsMetaNames | |
| from ibm_watsonx_ai import Credentials | |
| from langchain_ibm import WatsonxLLM, WatsonxEmbeddings | |
| from langchain.text_splitter import RecursiveCharacterTextSplitter | |
| from langchain_community.vectorstores import Chroma | |
| from langchain_community.document_loaders import PyPDFLoader | |
| from langchain.chains import RetrievalQA |
OlderNewer