royleibov commited on
Commit
9d507a5
1 Parent(s): c26563f

Add ZipNN structure

Browse files
Files changed (1) hide show
  1. README.md +61 -2
README.md CHANGED
@@ -7,7 +7,62 @@ pipeline_tag: text-generation
7
  tags:
8
  - nlp
9
  library_name: transformers
 
 
10
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  <p align="left">
13
  <a href="https://go.upstage.ai/3Xk9J6X">
@@ -50,9 +105,13 @@ Below is an example inference code that details loading the model, applying the
50
  # Load model
51
  import torch
52
  from transformers import AutoModelForCausalLM, AutoTokenizer
53
- tokenizer = AutoTokenizer.from_pretrained("upstage/solar-pro-preview-instruct")
 
 
 
 
54
  model = AutoModelForCausalLM.from_pretrained(
55
- "upstage/solar-pro-preview-instruct",
56
  device_map="cuda",
57
  torch_dtype="auto",
58
  trust_remote_code=True,
 
7
  tags:
8
  - nlp
9
  library_name: transformers
10
+ base_model:
11
+ - upstage/solar-pro-preview-instruct
12
  ---
13
+ # Disclaimer and Requirements
14
+
15
+ This model is a clone of [**upstage/solar-pro-preview-instruct**](https://huggingface.co/upstage/solar-pro-preview-instruct) compressed using ZipNN. Compressed losslessly to 67% its original size, ZipNN saved ~15GB in storage and potentially ~40TB in data transfer **monthly**.
16
+
17
+ ### Requirement
18
+
19
+ In order to use the model, ZipNN is necessary:
20
+ ```bash
21
+ pip install zipnn
22
+ ```
23
+ ### Use This Model
24
+ ```python
25
+ # Use a pipeline as a high-level helper
26
+ from transformers import pipeline
27
+ from zipnn import zipnn_hf
28
+
29
+ zipnn_hf()
30
+
31
+ messages = [
32
+ {"role": "user", "content": "Who are you?"},
33
+ ]
34
+ pipe = pipeline("text-generation", model="royleibov/solar-pro-preview-instruct-ZipNN-Compressed")
35
+ pipe(messages)
36
+ ```
37
+ ```python
38
+ # Load model directly
39
+ from transformers import AutoTokenizer, AutoModelForCausalLM
40
+ from zipnn import zipnn_hf
41
+
42
+ zipnn_hf()
43
+
44
+ tokenizer = AutoTokenizer.from_pretrained("royleibov/solar-pro-preview-instruct-ZipNN-Compressed")
45
+ model = AutoModelForCausalLM.from_pretrained(
46
+ "royleibov/solar-pro-preview-instruct-ZipNN-Compressed",
47
+ device_map="cuda",
48
+ torch_dtype="auto",
49
+ trust_remote_code=True,
50
+ )
51
+ ```
52
+ ### ZipNN
53
+ ZipNN also allows you to seemlessly save local disk space in your cache after the model is downloaded.
54
+
55
+ To compress the cached model, simply run:
56
+ ```bash
57
+ python zipnn_compress_path.py safetensors --model royleibov/solar-pro-preview-instruct-ZipNN-Compressed --hf_cache
58
+ ```
59
+
60
+ The model will be decompressed automatically and safely as long as `zipnn_hf()` is added at the top of the file like in the [example above](#use-this-model).
61
+
62
+ To decompress manualy, simply run:
63
+ ```bash
64
+ python zipnn_decompress_path.py --model royleibov/solar-pro-preview-instruct-ZipNN-Compressed --hf_cache
65
+ ```
66
 
67
  <p align="left">
68
  <a href="https://go.upstage.ai/3Xk9J6X">
 
105
  # Load model
106
  import torch
107
  from transformers import AutoModelForCausalLM, AutoTokenizer
108
+ from zipnn import zipnn_hf
109
+
110
+ zipnn_hf()
111
+
112
+ tokenizer = AutoTokenizer.from_pretrained("royleibov/solar-pro-preview-instruct-ZipNN-Compressed")
113
  model = AutoModelForCausalLM.from_pretrained(
114
+ "royleibov/solar-pro-preview-instruct-ZipNN-Compressed",
115
  device_map="cuda",
116
  torch_dtype="auto",
117
  trust_remote_code=True,