This file contains 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 json | |
import sys | |
import os | |
import urllib.request | |
match = sys.argv[1] | |
filepath = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"#sys.argv[2] | |
def get_versions(filepath): | |
if os.path.exists(filepath): |
This file contains 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 langchain.callbacks.manager import AsyncCallbackManager | |
import os, logging | |
logger = logging.getLogger(__name__) | |
stream_manager = AsyncCallbackManager([]) | |
from langchain_google_vertexai import VertexAIModelGarden | |
from typing import Any, List, Optional |
This file contains 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
""" | |
I found myself waiting for LLM model to give me result. My result is always the same since I am working on the lower level library. | |
Example | |
@memoize("test.pkl") | |
def sum(x, y): | |
return x + y | |
""" |
This file contains 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 nvidia/cuda:11.2.2-runtime-ubuntu20.04 | |
RUN apt-get update --yes --quiet | |
RUN apt install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa -y && \ | |
apt-get install -y python3.10 \ | |
pip \ | |
python3.10-distutils \ | |
curl | |
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 |
This file contains 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 google.auth | |
from google.auth.transport.requests import Request | |
import requests | |
def get_credentials() -> str: | |
credentials, _project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/cloud-platform']) | |
request = Request() | |
credentials.refresh(request) | |
return credentials |
This file contains 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 transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, HfArgumentParser, TrainingArguments, pipeline, logging, TextStreamer | |
from peft import LoraConfig, PeftModel, prepare_model_for_kbit_training, get_peft_model | |
import os,torch, platform, warnings | |
from datasets import load_dataset | |
from trl import SFTTrainer | |
class Lora: | |
@classmethod | |
def prepare(cls, model_name): | |
""" |
This file contains 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 unittest | |
from langchain.prompts import PromptTemplate | |
from langchain.llms import OpenAI | |
import logging | |
import sys | |
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
class Agent: | |
def __init__(self, role, objective): |
This file contains 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 argparse | |
import logging | |
from enum import EnumMeta | |
logger = logging.getLogger(__name__) | |
class Blackmore: | |
def __init__(self, name, functions): | |
self.name = name | |
self.functions = dict([[f.__name__, f] for f in functions]) |
This file contains 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 google.oauth2.credentials import Credentials | |
from google.cloud import bigquery | |
import google.oauth2.credentials | |
import os | |
PROJECT = os.environ.get("PROJECT") | |
# gcloud auth print-access-token | |
ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN") |
This file contains 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 langchain.chains import SequentialChain | |
from langchain.prompts import ChatPromptTemplate | |
from langchain.chains import LLMChain | |
from langchain.chat_models import ChatOpenAI | |
llm = ChatOpenAI(temperature=0.9) | |
class MyChain: | |
def __init__(self, llm=None, template_engine=None): | |
self.llm = llm |
NewerOlder