Spaces:
Build error
Build error
ubermenchh
commited on
Commit
·
6390543
1
Parent(s):
fe97892
Update app.py
Browse files
app.py
CHANGED
@@ -60,6 +60,7 @@ for i in range(0, len(data), batch_size):
|
|
60 |
index.upsert(vectors=zip(ids, embeds, metadata))
|
61 |
|
62 |
model_id = 'meta-llama/Llama-2-7b-chat-hf'
|
|
|
63 |
|
64 |
bnb_config = transformers.BitsAndBytesConfig(
|
65 |
load_in_4bit=True,
|
@@ -67,17 +68,18 @@ bnb_config = transformers.BitsAndBytesConfig(
|
|
67 |
bnb_4bit_use_double_quant=True,
|
68 |
bnb_4bit_compute_dtype=bfloat16
|
69 |
)
|
70 |
-
model_config = transformers.AutoConfig.from_pretrained(model_id)
|
71 |
model = transformers.AutoModelForCausalLM.from_pretrained(
|
72 |
model_id,
|
73 |
trust_remote_code=True,
|
74 |
config=model_config,
|
75 |
quantization_config=bnb_config,
|
76 |
-
device_map='auto'
|
|
|
77 |
)
|
78 |
model.eval()
|
79 |
|
80 |
-
tokenizer = transformer.AutoTokenizer.from_pretrained(model_id)
|
81 |
|
82 |
generate_text = transformers.pipeline(
|
83 |
model=model,
|
|
|
60 |
index.upsert(vectors=zip(ids, embeds, metadata))
|
61 |
|
62 |
model_id = 'meta-llama/Llama-2-7b-chat-hf'
|
63 |
+
hf_auth = os.environ.get('HF_AUTH_KEY')
|
64 |
|
65 |
bnb_config = transformers.BitsAndBytesConfig(
|
66 |
load_in_4bit=True,
|
|
|
68 |
bnb_4bit_use_double_quant=True,
|
69 |
bnb_4bit_compute_dtype=bfloat16
|
70 |
)
|
71 |
+
model_config = transformers.AutoConfig.from_pretrained(model_id, use_auth_token=hf_auth)
|
72 |
model = transformers.AutoModelForCausalLM.from_pretrained(
|
73 |
model_id,
|
74 |
trust_remote_code=True,
|
75 |
config=model_config,
|
76 |
quantization_config=bnb_config,
|
77 |
+
device_map='auto',
|
78 |
+
use_auth_token=hf_auth
|
79 |
)
|
80 |
model.eval()
|
81 |
|
82 |
+
tokenizer = transformer.AutoTokenizer.from_pretrained(model_id, use_auth_token=hf_auth)
|
83 |
|
84 |
generate_text = transformers.pipeline(
|
85 |
model=model,
|