Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,10 @@ import transformers
|
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
import torch
|
6 |
import gradio as gr
|
7 |
-
|
8 |
|
9 |
title = "Welcome to Tonic's 🐋🐳Orca-2-13B!"
|
10 |
-
description = "You can use [🐋🐳microsoft/Orca-2-13b](https://huggingface.co/microsoft/Orca-2-13b)
|
11 |
|
12 |
# os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:24'
|
13 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
@@ -17,7 +17,7 @@ offload_folder = './model_weights'
|
|
17 |
if not os.path.exists(offload_folder):
|
18 |
os.makedirs(offload_folder)
|
19 |
|
20 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, device_map='auto'
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False,)
|
22 |
model = model.to(torch.bfloat16)
|
23 |
|
|
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
import torch
|
6 |
import gradio as gr
|
7 |
+
import sentencepiece
|
8 |
|
9 |
title = "Welcome to Tonic's 🐋🐳Orca-2-13B!"
|
10 |
+
description = "You can use [🐋🐳microsoft/Orca-2-13b](https://huggingface.co/microsoft/Orca-2-13b) via API using Gradio by scrolling down and clicking Use 'Via API' or privately by [cloning this space on huggingface](https://huggingface.co/spaces/Tonic1/TonicsOrca2?duplicate=true) . [Join me on Discord to build together](https://discord.gg/VqTxc76K3u). Big thanks to the HuggingFace Organisation for the Community Grant."
|
11 |
|
12 |
# os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:24'
|
13 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
|
17 |
if not os.path.exists(offload_folder):
|
18 |
os.makedirs(offload_folder)
|
19 |
|
20 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map='auto')
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False,)
|
22 |
model = model.to(torch.bfloat16)
|
23 |
|