Update README.md
Browse files
README.md
CHANGED
@@ -7,6 +7,8 @@ Known Issues:
|
|
7 |
- While the results look pretty good, the model was not evaluated.
|
8 |
- Short inputs (i.e., "articles" of one line) will yield a contextless "summary".
|
9 |
|
|
|
|
|
10 |
|
11 |
# Data:
|
12 |
https://github.com/IAHLT/summarization_he
|
@@ -31,30 +33,13 @@ def summarize(text, tokenizer, model, num_beams=4, temperature=1, max_new_tokens
|
|
31 |
generated_text = tokenizer.decode(output_ids[0], skip_special_tokens=False)
|
32 |
|
33 |
return generated_text
|
34 |
-
|
35 |
-
|
36 |
-
# optional
|
37 |
-
use_4bit = True
|
38 |
-
bnb_4bit_compute_dtype = "float16"
|
39 |
-
bnb_4bit_quant_type = "nf4"
|
40 |
-
use_nested_quant = False
|
41 |
-
compute_dtype = getattr(torch, bnb_4bit_compute_dtype)
|
42 |
|
43 |
|
44 |
-
#
|
45 |
-
bnb_config = BitsAndBytesConfig(
|
46 |
-
load_in_4bit=use_4bit,
|
47 |
-
bnb_4bit_quant_type=bnb_4bit_quant_type,
|
48 |
-
bnb_4bit_compute_dtype=compute_dtype,
|
49 |
-
bnb_4bit_use_double_quant=use_nested_quant,
|
50 |
-
)
|
51 |
-
|
52 |
-
model_path = 'maayanorner/hebrew-summarization-llm'
|
53 |
|
54 |
model = AutoModelForCausalLM.from_pretrained(
|
55 |
model_path,
|
56 |
trust_remote_code=True,
|
57 |
-
quantization_config=bnb_config # optional
|
58 |
)
|
59 |
model.to('cuda')
|
60 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
|
7 |
- While the results look pretty good, the model was not evaluated.
|
8 |
- Short inputs (i.e., "articles" of one line) will yield a contextless "summary".
|
9 |
|
10 |
+
4-bit quantized version:
|
11 |
+
https://huggingface.co/maayanorner/hebrew-summarization-llm-4bit
|
12 |
|
13 |
# Data:
|
14 |
https://github.com/IAHLT/summarization_he
|
|
|
33 |
generated_text = tokenizer.decode(output_ids[0], skip_special_tokens=False)
|
34 |
|
35 |
return generated_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
|
38 |
+
model_path = 'maayanorner/hebrew-summarization-llm' # or https://huggingface.co/maayanorner/hebrew-summarization-llm-4bit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
model = AutoModelForCausalLM.from_pretrained(
|
41 |
model_path,
|
42 |
trust_remote_code=True,
|
|
|
43 |
)
|
44 |
model.to('cuda')
|
45 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|