Spaces:
Running
Running
from transformers import AutoModelForCausalLM, AutoTokenizer | |
import modin.pandas as pd | |
import gradio as gr | |
tokenizer = AutoTokenizer.from_pretrained("KoboldAI/OPT-2.7B-Nerybus-Mix") | |
model = AutoModelForCausalLM.from_pretrained("KoboldAI/OPT-2.7B-Nerybus-Mix") | |
def chat(Prompt): | |
input_ids = tokenizer(Prompt, return_tensors="pt").input_ids | |
generated_ids = model.generate(input_ids, use_cache=True, max_length=256, repetition_penalty = 2.5, top_k = 75, eos_token_id=tokenizer.eos_token_id) | |
bot = tokenizer.decode(generated_ids[0], skip_special_tokens=True) | |
return bot | |
title = 'Nerybus ChatBot' | |
description = 'This is an experimental model containing a parameter-wise 50/50 blend (weighted average) of the weights of NerysV2-2.7B and ErebusV1-2.7B Preliminary testing produces pretty coherent outputs, it appears to retain the NSFWness of Erebus but with a Nerys-esque twist in terms of prose. <br><br><b/> Warning: THIS model is NOT suitable for use by minors. The model will output X-rated content.' | |
article = 'The two models used for this blend, <a href=\"https://huggingface.co/KoboldAI/OPT-2.7B-Erebus\">ErebusV1-2.7B</a> and <a href=\"https://huggingface.co/KoboldAI/OPT-2.7B-Nerys-v2\">NerysV2-2.7B</a> are made by Mr. Seeker.' | |
gr.Interface(fn=chat, inputs='text', outputs='text', title=title, description=description, article=article).queue(max_size=10).launch(max_threads=40, debug=True) |