Skip to content

Commit 5b80748

Browse files
authored
update huggingface dependencies and calls (#1013)
1 parent 280f017 commit 5b80748

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
lines changed

pgml-dashboard/content/blog/announcing-gptq-and-ggml-quantized-llm-support-for-huggingface-transformers.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ PostgresML will automatically use GPTQ or GGML when a HuggingFace model has one
104104
SELECT pgml.transform(
105105
task => '{
106106
"task": "text-generation",
107-
"model": "mlabonne/gpt2-GPTQ-4bit"
107+
"model": "mlabonne/gpt2-GPTQ-4bit",
108+
"model_basename": "gptq_model-4bit-128g",
109+
"use_triton": true,
110+
"use_safetensors": true
108111
}'::JSONB,
109112
inputs => ARRAY[
110113
'Once upon a time,'

pgml-extension/examples/transformers.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ SELECT pgml.transform(
9090
'Dominic Cobb is the foremost practitioner of the artistic science of extraction, inserting oneself into a subject''s dreams to obtain hidden information without the subject knowing, a concept taught to him by his professor father-in-law, Dr. Stephen Miles. Dom''s associates are Miles'' former students, who Dom requires as he has given up being the dream architect for reasons he won''t disclose. Dom''s primary associate, Arthur, believes it has something to do with Dom''s deceased wife, Mal, who often figures prominently and violently in those dreams, or Dom''s want to "go home" (get back to his own reality, which includes two young children). Dom''s work is generally in corporate espionage. As the subjects don''t want the information to get into the wrong hands, the clients have zero tolerance for failure. Dom is also a wanted man, as many of his past subjects have learned what Dom has done to them. One of those subjects, Mr. Saito, offers Dom a job he can''t refuse: to take the concept one step further into inception, namely planting thoughts into the subject''s dreams without them knowing. Inception can fundamentally alter that person as a being. Saito''s target is Robert Michael Fischer, the heir to an energy business empire, which has the potential to rule the world if continued on the current trajectory. Beyond the complex logistics of the dream architecture of the case and some unknowns concerning Fischer, the biggest obstacles in success for the team become worrying about one aspect of inception which Cobb fails to disclose to the other team members prior to the job, and Cobb''s newest associate Ariadne''s belief that Cobb''s own subconscious, especially as it relates to Mal, may be taking over what happens in the dreams.'
9191
]
9292
);
93+
9394
SELECT pgml.transform(
9495
task => '{"task": "text-classification",
9596
"model": "finiteautomata/bertweet-base-sentiment-analysis"
9697
}'::JSONB,
9798
inputs => ARRAY[
98-
'I love how amazingly simple ML has become!',
99+
'I love how amazingly simple ML has become!',
99100
'I hate doing mundane and thankless tasks. ☹️'
100-
],
101+
]
101102
) AS positivity;
102103

103104
SELECT pgml.transform(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xformers==0.0.20
1+
xformers==0.0.21

pgml-extension/requirements.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
accelerate==0.21.0
2-
auto-gptq==0.3.0
3-
bitsandbytes==0.40.2
1+
accelerate==0.22.0
2+
auto-gptq==0.4.2
3+
bitsandbytes==0.41.1
44
catboost==1.2
5-
ctransformers==0.2.13
6-
datasets==2.13.1
7-
deepspeed==0.10.0
8-
huggingface-hub==0.16.4
5+
ctransformers==0.2.27
6+
datasets==2.14.5
7+
deepspeed==0.10.3
8+
huggingface-hub==0.17.1
99
InstructorEmbedding==1.0.1
10-
lightgbm==4.0.0
11-
orjson==3.9.2
12-
pandas==2.0.3
13-
rich==13.4.2
10+
lightgbm==4.1.0
11+
orjson==3.9.7
12+
pandas==2.1.0
13+
rich==13.5.2
1414
rouge==1.0.1
1515
sacrebleu==2.3.1
1616
sacremoses==0.0.53
@@ -21,9 +21,9 @@ tokenizers==0.13.3
2121
torch==2.0.1
2222
torchaudio==2.0.2
2323
torchvision==0.15.2
24-
tqdm==4.65.0
25-
transformers==4.31.0
26-
xgboost==1.7.6
27-
langchain==0.0.237
24+
tqdm==4.66.1
25+
transformers==4.33.1
26+
xgboost==2.0.0
27+
langchain==0.0.287
2828
einops==0.6.1
2929
pynvml==11.5.0

pgml-extension/src/bindings/transformers/transformers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ def ensure_device(kwargs):
8989

9090
class GPTQPipeline(object):
9191
def __init__(self, model_name, **task):
92-
import auto_gptq
92+
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
9393
from huggingface_hub import snapshot_download
9494
model_path = snapshot_download(model_name)
9595

96-
self.model = auto_gptq.AutoGPTQForCausalLM.from_quantized(model_path, **task)
96+
quantized_config = BaseQuantizeConfig.from_pretrained(model_path)
97+
self.model = AutoGPTQForCausalLM.from_quantized(model_path, quantized_config=quantized_config, **task)
9798
if "use_fast_tokenizer" in task:
9899
self.tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=task.pop("use_fast_tokenizer"))
99100
else:
@@ -192,9 +193,13 @@ def create_pipeline(task):
192193
ensure_device(task)
193194
convert_dtype(task)
194195
model_name = task.get("model", None)
195-
if model_name and "-ggml" in model_name:
196+
if model_name:
197+
lower = model_name.lower()
198+
else:
199+
lower = None
200+
if lower and "-ggml" in lower:
196201
pipe = GGMLPipeline(model_name, **task)
197-
elif model_name and "-gptq" in model_name:
202+
elif lower and "-gptq" in lower:
198203
pipe = GPTQPipeline(model_name, **task)
199204
else:
200205
try:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy