Text Generation
Transformers
Safetensors
llama
text-generation-inference
8-bit precision
bitsandbytes
Instructions to use PhantHive/bigbrain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PhantHive/bigbrain with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PhantHive/bigbrain")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PhantHive/bigbrain") model = AutoModelForCausalLM.from_pretrained("PhantHive/bigbrain", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PhantHive/bigbrain with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PhantHive/bigbrain" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PhantHive/bigbrain", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PhantHive/bigbrain
- SGLang
How to use PhantHive/bigbrain with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "PhantHive/bigbrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PhantHive/bigbrain", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "PhantHive/bigbrain" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PhantHive/bigbrain", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PhantHive/bigbrain with Docker Model Runner:
docker model run hf.co/PhantHive/bigbrain
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from peft import PeftModel, PeftConfig
|
| 3 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
-
import torch
|
| 5 |
-
|
| 6 |
-
# Load the model and config when the script starts
|
| 7 |
-
config = PeftConfig.from_pretrained("PhantHive/bigbrain")
|
| 8 |
-
model = AutoModelForCausalLM.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
|
| 9 |
-
model = PeftModel.from_pretrained(model, "PhantHive/bigbrain")
|
| 10 |
-
|
| 11 |
-
# Load the tokenizer
|
| 12 |
-
tokenizer = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
def greet(text):
|
| 16 |
-
batch = tokenizer(f"'{text}' ->: ", return_tensors='pt')
|
| 17 |
-
|
| 18 |
-
# Use torch.no_grad to disable gradient calculation
|
| 19 |
-
with torch.no_grad():
|
| 20 |
-
output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=50)
|
| 21 |
-
|
| 22 |
-
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 26 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|