CreitinGameplays
commited on
Commit
•
b7402af
1
Parent(s):
3cfe997
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import torch
|
|
3 |
import bitsandbytes as bnb
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
5 |
|
|
|
6 |
# BNB config
|
7 |
bnb_config = BitsAndBytesConfig(
|
8 |
load_in_4bit=True,
|
@@ -10,6 +11,7 @@ bnb_config = BitsAndBytesConfig(
|
|
10 |
bnb_4bit_quant_type="nf4",
|
11 |
bnb_4bit_compute_dtype=torch.bfloat16
|
12 |
)
|
|
|
13 |
|
14 |
#quantization_config=bnb_config
|
15 |
|
@@ -18,7 +20,7 @@ model_name = "CreitinGameplays/bloom-3b-conversational"
|
|
18 |
|
19 |
# Load tokenizer and model
|
20 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
21 |
-
model = AutoModelForCausalLM.from_pretrained(model_name
|
22 |
|
23 |
def generate_text(user_prompt):
|
24 |
"""Generates text using the BLOOM model from Hugging Face Transformers and removes the user prompt."""
|
|
|
3 |
import bitsandbytes as bnb
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
5 |
|
6 |
+
"""
|
7 |
# BNB config
|
8 |
bnb_config = BitsAndBytesConfig(
|
9 |
load_in_4bit=True,
|
|
|
11 |
bnb_4bit_quant_type="nf4",
|
12 |
bnb_4bit_compute_dtype=torch.bfloat16
|
13 |
)
|
14 |
+
"""
|
15 |
|
16 |
#quantization_config=bnb_config
|
17 |
|
|
|
20 |
|
21 |
# Load tokenizer and model
|
22 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
24 |
|
25 |
def generate_text(user_prompt):
|
26 |
"""Generates text using the BLOOM model from Hugging Face Transformers and removes the user prompt."""
|