Browse Source

chatbot remote worker test

master
Hendrik Langer 2 years ago
parent
commit
d78181974b
  1. 7
      runpod/runpod-worker-transformers/Dockerfile
  2. 15
      runpod/runpod-worker-transformers/model_fetcher.py

7
runpod/runpod-worker-transformers/Dockerfile

@ -1,6 +1,9 @@
ARG BASE_IMAGE=nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04 ARG BASE_IMAGE=nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04
FROM ${BASE_IMAGE} as dev-base FROM ${BASE_IMAGE} as dev-base
ARG MODEL_NAME
ENV MODEL_NAME=${MODEL_NAME}
WORKDIR / WORKDIR /
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND noninteractive\ ENV DEBIAN_FRONTEND noninteractive\
@ -44,11 +47,11 @@ RUN mkdir /workspace
WORKDIR /workspace WORKDIR /workspace
COPY model_fetcher.py /workspace/ COPY model_fetcher.py /workspace/
RUN python model_fetcher.py --model_name=${MODEL_NAME} RUN python3 model_fetcher.py --model_name=${MODEL_NAME}
#RUN git lfs install && \ #RUN git lfs install && \
# git clone --depth 1 https://huggingface.co/${MODEL_NAME} # git clone --depth 1 https://huggingface.co/${MODEL_NAME}
COPY runpod_infer.py /workspace/ COPY runpod_infer.py /workspace/
COPY test_input.json /workspace/ COPY test_input.json /workspace/
CMD python -u runpod_infer.py --model_name=${MODEL_NAME} CMD python3 -u runpod_infer.py --model_name=${MODEL_NAME}

15
runpod/runpod-worker-transformers/model_fetcher.py

@ -7,7 +7,7 @@ import argparse
import torch import torch
from transformers import (GPTNeoForCausalLM, GPT2Tokenizer, GPTNeoXForCausalLM, from transformers import (GPTNeoForCausalLM, GPT2Tokenizer, GPTNeoXForCausalLM,
GPTNeoXTokenizerFast, GPTJForCausalLM, AutoTokenizer, AutoModelForCausalLM) GPTNeoXTokenizerFast, GPTJForCausalLM, AutoTokenizer, AutoModelForCausalLM)
from huggingface_hub import snapshot_download
def download_model(model_name): def download_model(model_name):
@ -28,8 +28,9 @@ def download_model(model_name):
# --------------------------------- Pygmalion -------------------------------- # # --------------------------------- Pygmalion -------------------------------- #
elif model_name == 'pygmalion-6b': elif model_name == 'pygmalion-6b':
AutoModelForCausalLM.from_pretrained("PygmalionAI/pygmalion-6b") # AutoModelForCausalLM.from_pretrained("PygmalionAI/pygmalion-6b", load_in_8bit=True)
AutoTokenizer.from_pretrained("PygmalionAI/pygmalion-6b") # AutoTokenizer.from_pretrained("PygmalionAI/pygmalion-6b")
snapshot_download(repo_id="PygmalionAI/pygmalion-6b", revision="main")
# ----------------------------------- GPT-J ----------------------------------- # # ----------------------------------- GPT-J ----------------------------------- #
elif model_name == 'gpt-j-6b': elif model_name == 'gpt-j-6b':
@ -39,17 +40,17 @@ def download_model(model_name):
# ------------------------------ PPO Shygmalion 6B ----------------------------- # # ------------------------------ PPO Shygmalion 6B ----------------------------- #
elif model_name == 'ppo-shygmalion-6b': elif model_name == 'ppo-shygmalion-6b':
AutoModelForCausalLM.from_pretrained("TehVenom/PPO_Shygmalion-6b") AutoModelForCausalLM.from_pretrained("TehVenom/PPO_Shygmalion-6b", load_in_8bit=True)
AutoTokenizer.from_pretrained("TehVenom/PPO_Shygmalion-6b") AutoTokenizer.from_pretrained("TehVenom/PPO_Shygmalion-6b")
# ------------------------------ Dolly Shygmalion 6B ----------------------------- # # ------------------------------ Dolly Shygmalion 6B ----------------------------- #
elif model_name == 'dolly-shygmalion-6b': elif model_name == 'dolly-shygmalion-6b':
AutoModelForCausalLM.from_pretrained("TehVenom/Dolly_Shygmalion-6b") AutoModelForCausalLM.from_pretrained("TehVenom/Dolly_Shygmalion-6b", load_in_8bit=True)
AutoTokenizer.from_pretrained("TehVenom/Dolly_Shygmalion-6b") AutoTokenizer.from_pretrained("TehVenom/Dolly_Shygmalion-6b")
# ------------------------------ Erebus 13B (NSFW) ----------------------------- # # ------------------------------ Erebus 13B (NSFW) ----------------------------- #
elif model_name == 'erebus-13b': elif model_name == 'erebus-13b':
AutoModelForCausalLM.from_pretrained("KoboldAI/OPT-13B-Erebus") AutoModelForCausalLM.from_pretrained("KoboldAI/OPT-13B-Erebus", load_in_8bit=True)
AutoTokenizer.from_pretrained("KoboldAI/OPT-13B-Erebus") AutoTokenizer.from_pretrained("KoboldAI/OPT-13B-Erebus")
# --------------------------- Alpaca 13B (Quantized) -------------------------- # # --------------------------- Alpaca 13B (Quantized) -------------------------- #
@ -59,7 +60,7 @@ def download_model(model_name):
# --------------------------------- Alpaca 13B -------------------------------- # # --------------------------------- Alpaca 13B -------------------------------- #
elif model_name == 'gpt4-x-alpaca': elif model_name == 'gpt4-x-alpaca':
AutoModelForCausalLM.from_pretrained("chavinlo/gpt4-x-alpaca") AutoModelForCausalLM.from_pretrained("chavinlo/gpt4-x-alpaca", load_in_8bit=True)
AutoTokenizer.from_pretrained("chavinlo/gpt4-x-alpaca") AutoTokenizer.from_pretrained("chavinlo/gpt4-x-alpaca")

Loading…
Cancel
Save