Upload folder using huggingface_hub (#1)
Browse files- f6fd43b0ab78cd2072d15b2bc2615f67d8e027efbc2925300f3070c8ac22ec76 (85b8f342f2d4b6183340650f40b0db4c835d220e)
- README.md +84 -0
- config.json +40 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- plots.png +0 -0
- smash_config.json +27 -0
README.md
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
|
3 |
+
metrics:
|
4 |
+
- memory_disk
|
5 |
+
- memory_inference
|
6 |
+
- inference_latency
|
7 |
+
- inference_throughput
|
8 |
+
- inference_CO2_emissions
|
9 |
+
- inference_energy_consumption
|
10 |
+
tags:
|
11 |
+
- pruna-ai
|
12 |
+
---
|
13 |
+
<!-- header start -->
|
14 |
+
<!-- 200823 -->
|
15 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
16 |
+
<a href="https://www.pruna.ai/" target="_blank" rel="noopener noreferrer">
|
17 |
+
<img src="https://i.imgur.com/eDAlcgk.png" alt="PrunaAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
18 |
+
</a>
|
19 |
+
</div>
|
20 |
+
<!-- header end -->
|
21 |
+
|
22 |
+
[![Twitter](https://img.shields.io/twitter/follow/PrunaAI?style=social)](https://twitter.com/PrunaAI)
|
23 |
+
[![GitHub](https://img.shields.io/github/followers/PrunaAI?label=Follow%20%40PrunaAI&style=social)](https://github.com/PrunaAI)
|
24 |
+
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following)
|
25 |
+
[![Discord](https://img.shields.io/badge/Discord-Join%20Us-blue?style=social&logo=discord)](https://discord.gg/CP4VSgck)
|
26 |
+
|
27 |
+
# Simply make AI models cheaper, smaller, faster, and greener!
|
28 |
+
|
29 |
+
- Give a thumbs up if you like this model!
|
30 |
+
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
31 |
+
- Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
32 |
+
- Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
|
33 |
+
- Join Pruna AI community on Discord [here](https://discord.gg/CP4VSgck) to share feedback/suggestions or get help.
|
34 |
+
|
35 |
+
## Results
|
36 |
+
|
37 |
+
![image info](./plots.png)
|
38 |
+
|
39 |
+
**Frequently Asked Questions**
|
40 |
+
- ***How does the compression work?*** The model is compressed with llm-int8.
|
41 |
+
- ***How does the model quality change?*** The quality of the model output might vary compared to the base model.
|
42 |
+
- ***How is the model efficiency evaluated?*** These results were obtained on NVIDIA A100-PCIE-40GB with configuration described in `model/smash_config.json` and are obtained after a hardware warmup. The smashed model is directly compared to the original base model. Efficiency results may vary in other settings (e.g. other hardware, image size, batch size, ...). We recommend to directly run them in the use-case conditions to know if the smashed model can benefit you.
|
43 |
+
- ***What is the model format?*** We use safetensors.
|
44 |
+
- ***What calibration data has been used?*** If needed by the compression method, we used WikiText as the calibration data.
|
45 |
+
- ***What is the naming convention for Pruna Huggingface models?*** We take the original model name and append "turbo", "tiny", or "green" if the smashed model has a measured inference speed, inference memory, or inference energy consumption which is less than 90% of the original base model.
|
46 |
+
- ***How to compress my own models?*** You can request premium access to more compression methods and tech support for your specific use-cases [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
47 |
+
- ***What are "first" metrics?*** Results mentioning "first" are obtained after the first run of the model. The first run might take more memory or be slower than the subsequent runs due cuda overheads.
|
48 |
+
- ***What are "Sync" and "Async" metrics?*** "Sync" metrics are obtained by syncing all GPU processes and stop measurement when all of them are executed. "Async" metrics are obtained without syncing all GPU processes and stop when the model output can be used by the CPU. We provide both metrics since both could be relevant depending on the use-case. We recommend to test the efficiency gains directly in your use-cases.
|
49 |
+
|
50 |
+
## Setup
|
51 |
+
|
52 |
+
You can run the smashed model with these steps:
|
53 |
+
|
54 |
+
0. Check requirements from the original repo Locutusque/TinyMistral-248M installed. In particular, check python, cuda, and transformers versions.
|
55 |
+
1. Make sure that you have installed quantization related packages.
|
56 |
+
```bash
|
57 |
+
pip install transformers accelerate bitsandbytes>0.37.0
|
58 |
+
```
|
59 |
+
2. Load & run the model.
|
60 |
+
```python
|
61 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
62 |
+
|
63 |
+
model = AutoModelForCausalLM.from_pretrained("PrunaAI/Locutusque-TinyMistral-248M-bnb-8bit-smashed",
|
64 |
+
trust_remote_code=True)
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained("Locutusque/TinyMistral-248M")
|
66 |
+
|
67 |
+
input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
|
68 |
+
|
69 |
+
outputs = model.generate(input_ids, max_new_tokens=216)
|
70 |
+
tokenizer.decode(outputs[0])
|
71 |
+
```
|
72 |
+
|
73 |
+
## Configurations
|
74 |
+
|
75 |
+
The configuration info are in `smash_config.json`.
|
76 |
+
|
77 |
+
## Credits & License
|
78 |
+
|
79 |
+
The license of the smashed model follows the license of the original model. Please check the license of the original model Locutusque/TinyMistral-248M before using this model which provided the base model. The license of the `pruna-engine` is [here](https://pypi.org/project/pruna-engine/) on Pypi.
|
80 |
+
|
81 |
+
## Want to compress other models?
|
82 |
+
|
83 |
+
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
84 |
+
- Request access to easily compress your own AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/tmp/tmpp105kot4",
|
3 |
+
"architectures": [
|
4 |
+
"MistralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 1024,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 4096,
|
13 |
+
"max_position_embeddings": 32768,
|
14 |
+
"model_type": "mistral",
|
15 |
+
"num_attention_heads": 32,
|
16 |
+
"num_hidden_layers": 12,
|
17 |
+
"num_key_value_heads": 8,
|
18 |
+
"quantization_config": {
|
19 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
20 |
+
"bnb_4bit_quant_type": "fp4",
|
21 |
+
"bnb_4bit_use_double_quant": true,
|
22 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
23 |
+
"llm_int8_has_fp16_weight": false,
|
24 |
+
"llm_int8_skip_modules": [
|
25 |
+
"lm_head"
|
26 |
+
],
|
27 |
+
"llm_int8_threshold": 6.0,
|
28 |
+
"load_in_4bit": false,
|
29 |
+
"load_in_8bit": true,
|
30 |
+
"quant_method": "bitsandbytes"
|
31 |
+
},
|
32 |
+
"rms_norm_eps": 1e-06,
|
33 |
+
"rope_theta": 10000.0,
|
34 |
+
"sliding_window": 32,
|
35 |
+
"tie_word_embeddings": false,
|
36 |
+
"torch_dtype": "float16",
|
37 |
+
"transformers_version": "4.37.1",
|
38 |
+
"use_cache": true,
|
39 |
+
"vocab_size": 32005
|
40 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"transformers_version": "4.37.1"
|
6 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:176d73ac3799b7c335cf3ca504f01234d88c6e1bc1c1620f3baf8d10a6a39700
|
3 |
+
size 314181744
|
plots.png
ADDED
smash_config.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"api_key": null,
|
3 |
+
"verify_url": "http://johnrachwan.pythonanywhere.com",
|
4 |
+
"smash_config": {
|
5 |
+
"pruners": "None",
|
6 |
+
"factorizers": "None",
|
7 |
+
"quantizers": "['llm-int8']",
|
8 |
+
"compilers": "None",
|
9 |
+
"task": "text_text_generation",
|
10 |
+
"device": "cuda",
|
11 |
+
"cache_dir": "/ceph/hdd/staff/charpent/.cache/modelsug2gyj8n",
|
12 |
+
"batch_size": 1,
|
13 |
+
"model_name": "Locutusque/TinyMistral-248M",
|
14 |
+
"pruning_ratio": 0.0,
|
15 |
+
"n_quantization_bits": 8,
|
16 |
+
"output_deviation": 0.005,
|
17 |
+
"max_batch_size": 1,
|
18 |
+
"qtype_weight": "torch.qint8",
|
19 |
+
"qtype_activation": "torch.quint8",
|
20 |
+
"qobserver": "<class 'torch.ao.quantization.observer.MinMaxObserver'>",
|
21 |
+
"qscheme": "torch.per_tensor_symmetric",
|
22 |
+
"qconfig": "x86",
|
23 |
+
"group_size": 128,
|
24 |
+
"damp_percent": 0.1,
|
25 |
+
"save_load_fn": "bitsandbytes"
|
26 |
+
}
|
27 |
+
}
|