conda create -n llama
conda activate llama
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install cudatoolkit==11.8.0 -c conda-forge
python -s -m pip install bitsandbytes accelerate sentencepiece
python -s -m pip install git+https://github.com/huggingface/transformers
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
| (function (){ | |
| var context = new AudioContext(); | |
| source = context.createMediaElementSource(document.querySelector('video')); | |
| splitter = context.createChannelSplitter(); | |
| merger = context.createChannelMerger(); | |
| source.connect(splitter); | |
| splitter.connect(merger, 0, 0); // first 0 is input channel | |
| splitter.connect(merger, 0, 1); | |
| merger.connect(context.destination); | |
| })(); |
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 time | |
| import numpy as np | |
| import pyopencl as cl | |
| def main(): | |
| bytes_size = 10*1024*1024*1024 | |
| num_of_floats = bytes_size // 4 | |
| devices = sum([x.get_devices(device_type=cl.device_type.GPU) for x in cl.get_platforms()], []) | |
| device = devices[0] |
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
| from flask import Flask, Response | |
| import time | |
| import json | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return Response(''' | |
| <!DOCTYPE html> |
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 os | |
| os.environ["OPENAI_API_KEY"] = "" | |
| from flask import Flask, Response, request | |
| import threading | |
| import queue | |
| from langchain.chat_models import ChatOpenAI | |
| from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler | |
| from langchain.schema import AIMessage, HumanMessage, SystemMessage |
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 "tglang.h" | |
| #include "weights.h" | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <math.h> |
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
| from tinygrad import Tensor, TinyJit, nn | |
| from tinygrad.helpers import JIT | |
| from tinygrad.nn.optim import SGD | |
| from tinygrad.nn.state import get_parameters | |
| class TinyNet: | |
| def __init__(self): | |
| self.l1 = nn.Linear(784, 128, bias=False) | |
| self.l2 = nn.Linear(128, 10, bias=False) |
OlderNewer