kettleguts commited on
Commit
ccdcad2
1 Parent(s): a581c28

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -85
README.md CHANGED
@@ -37,36 +37,21 @@ This model is not suitable for direct use outside of research.
37
  This model should never be used for critical decisions involving health, life, employment, housing, law, etc. It should also never be used to harm anyone.
38
 
39
 
 
 
40
  ## Bias, Risks, and Limitations
41
 
42
  [No safegaurd have been added to this model.](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta#bias-risks-and-limitations)
43
 
44
  ## How to Get Started with the Model
45
 
46
- Use the code below to get started with the model.
47
-
48
- '''python
49
- from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, pipeline
50
-
51
- model_name = 'kettleguts/zephyr-7b-beta_sparse05'
52
-
53
- #quantize model for mode efficient performance
54
- bnb_config = BitsAndBytesConfig(
55
- load_in_4bit=True,
56
- bnb_4bit_use_double_quant=True,
57
- bnb_4bit_quant_type="nf4",
58
- bnb_4bit_compute_dtype=torch.bfloat16
59
- )
60
 
61
- #load model
62
- model = AutoModelForCausalLM.from_pretrained(model_name,
63
- device_map = "auto",
64
- quantization_config=bnb_config)
65
 
66
- #load toeknizer
67
- tokenizer = AutoTokenizer.from_pretrained(model_name)
68
- if tokenizer.pad_token is None:
69
- tokenizer.add_special_tokens({'pad_token': '[PAD]'})
70
 
71
  pipe = pipeline("text-generation",model=model, tokenizer=tokenizer)
72
 
@@ -75,92 +60,57 @@ messages = [
75
  "role": "system",
76
  "content": "You are a friendly chatbot who always responds as briefly as possible with prefect grammar.",
77
  },
78
- {"role": "user", "content": "Briefly describe network pruning."},
79
- ]
 
80
  prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
81
- outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95,pad_token_id = tokenizer.pad_token_id)
 
 
 
 
 
 
 
 
82
  text = str(outputs[0]).split('<|assistant|>\\n')
83
  print(text[-1])
84
 
85
- #Network pruning, in the context of artificial intelligence and machine learning, refers to the process of removing unimportant or redundant connections, or "pruning," from a neural network\'s architecture. This is done to simplify and optimize the network\'s structure, reduce overfitting, and improve its efficiency, while preserving its overall performance. Pruning typically involves removing connections, neurons, or entire layers, based on metrics such as the weight or sparsity of the connection, or the amount of improvement gained by removing the connection. The goal is to prune the network in a way that balances the trade-off between model size and accuracy, while reducing the network\'s overall complexity and resource requirements. Pruning techniques can range from simple heuristics such as early stopping, to more sophisticated methods such as compressed and pruned models, and iterative and incremental pruning.'}
86
- '''
87
-
88
 
 
89
 
 
 
90
 
91
  ## Evaluation
92
 
93
- <!-- This section describes the evaluation protocols and provides the results. -->
94
-
95
- ### Testing Data, Factors & Metrics
96
-
97
- #### Testing Data
98
-
99
- <!-- This should link to a Dataset Card if possible. -->
100
-
101
- [More Information Needed]
102
-
103
- #### Factors
104
-
105
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
106
-
107
- [More Information Needed]
108
-
109
- #### Metrics
110
-
111
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
112
-
113
- [More Information Needed]
114
-
115
- ### Results
116
-
117
- [More Information Needed]
118
-
119
- #### Summary
120
-
121
 
122
 
123
  ## Model Examination [optional]
124
 
125
  <!-- Relevant interpretability work for the model goes here -->
126
-
127
- [More Information Needed]
128
 
129
  ## Environmental Impact
130
 
131
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
132
-
133
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
134
-
135
- - **Hardware Type:** [More Information Needed]
136
- - **Hours used:** [More Information Needed]
137
- - **Cloud Provider:** [More Information Needed]
138
- - **Compute Region:** [More Information Needed]
139
- - **Carbon Emitted:** [More Information Needed]
140
 
141
  ## Technical Specifications [optional]
142
 
143
- ### Model Architecture and Objective
144
-
145
- [More Information Needed]
146
-
147
- ### Compute Infrastructure
148
-
149
- [More Information Needed]
150
-
151
- #### Hardware
152
-
153
- [More Information Needed]
154
 
155
  #### Software
156
 
157
- [More Information Needed]
 
158
 
159
  ## Citation [optional]
160
 
161
  **BibTeX:**
162
- '''
163
- @misc{tunstall2023zephyr,
 
164
  title={Zephyr: Direct Distillation of LM Alignment},
165
  author={Lewis Tunstall and Edward Beeching and Nathan Lambert and Nazneen Rajani and Kashif Rasul and Younes Belkada and Shengyi Huang and Leandro von Werra and Clémentine Fourrier and Nathan Habib and Nathan Sarrazin and Omar Sanseviero and Alexander M. Rush and Thomas Wolf},
166
  year={2023},
@@ -168,9 +118,9 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
168
  archivePrefix={arXiv},
169
  primaryClass={cs.LG}
170
  }
171
- '''
172
- '''
173
- @misc{sun2023simple,
174
  title={A Simple and Effective Pruning Approach for Large Language Models},
175
  author={Mingjie Sun and Zhuang Liu and Anna Bair and J. Zico Kolter},
176
  year={2023},
@@ -178,5 +128,8 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
178
  archivePrefix={arXiv},
179
  primaryClass={cs.CL}
180
  }
181
- '''
 
 
 
182
 
 
37
  This model should never be used for critical decisions involving health, life, employment, housing, law, etc. It should also never be used to harm anyone.
38
 
39
 
40
+
41
+
42
  ## Bias, Risks, and Limitations
43
 
44
  [No safegaurd have been added to this model.](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta#bias-risks-and-limitations)
45
 
46
  ## How to Get Started with the Model
47
 
48
+ Use the code below to get started with the model:
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ <blockquote>
51
+
52
+ ```Python
 
53
 
54
+ from transformers import pipeline
 
 
 
55
 
56
  pipe = pipeline("text-generation",model=model, tokenizer=tokenizer)
57
 
 
60
  "role": "system",
61
  "content": "You are a friendly chatbot who always responds as briefly as possible with prefect grammar.",
62
  },
63
+ {"role": "user", "content": "Briefly describe network pruning."},
64
+ ]
65
+
66
  prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
67
+
68
+ outputs = pipe(prompt,
69
+ max_new_tokens=256,
70
+ do_sample=True,
71
+ temperature=0.7,
72
+ top_k=50,
73
+ top_p=0.95,
74
+ pad_token_id = tokenizer.pad_token_id)
75
+
76
  text = str(outputs[0]).split('<|assistant|>\\n')
77
  print(text[-1])
78
 
79
+ ```
 
 
80
 
81
+ </blockquote>
82
 
83
+ Output:
84
+ >Network pruning, in the context of artificial intelligence and machine learning, refers to the process of removing unimportant or redundant connections, or "pruning," from a neural network\'s architecture. This is done to simplify and optimize the network\'s structure, reduce overfitting, and improve its efficiency, while preserving its overall performance. Pruning typically involves removing connections, neurons, or entire layers, based on metrics such as the weight or sparsity of the connection, or the amount of improvement gained by removing the connection. The goal is to prune the network in a way that balances the trade-off between model size and accuracy, while reducing the network\'s overall complexity and resource requirements. Pruning techniques can range from simple heuristics such as early stopping, to more sophisticated methods such as compressed and pruned models, and iterative and incremental pruning.'}
85
 
86
  ## Evaluation
87
 
88
+ Pending
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
 
91
  ## Model Examination [optional]
92
 
93
  <!-- Relevant interpretability work for the model goes here -->
94
+ Pending
 
95
 
96
  ## Environmental Impact
97
 
98
+ The calculations necessary to prune this model required less than 1 hour of time on a T4 GPU in Colab.
 
 
 
 
 
 
 
 
99
 
100
  ## Technical Specifications [optional]
101
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  #### Software
104
 
105
+ The bulk of this work was done using [Pytorch](https://pytorch.org/). They have an array of built-in [pruning tools](https://pytorch.org/docs/stable/nn.html#:~:text=Utility%20classes%20and%20functions%20for%20pruning%20Module%20parameters
106
+ ) in torch.nn . Also check out the [tutorial](https://pytorch.org/tutorials/intermediate/pruning_tutorial.html) by [Michela Paganini](https://github.com/mickypaganini).
107
 
108
  ## Citation [optional]
109
 
110
  **BibTeX:**
111
+ <code>
112
+
113
+ >@misc{tunstall2023zephyr,
114
  title={Zephyr: Direct Distillation of LM Alignment},
115
  author={Lewis Tunstall and Edward Beeching and Nathan Lambert and Nazneen Rajani and Kashif Rasul and Younes Belkada and Shengyi Huang and Leandro von Werra and Clémentine Fourrier and Nathan Habib and Nathan Sarrazin and Omar Sanseviero and Alexander M. Rush and Thomas Wolf},
116
  year={2023},
 
118
  archivePrefix={arXiv},
119
  primaryClass={cs.LG}
120
  }
121
+
122
+
123
+ >@misc{sun2023simple,
124
  title={A Simple and Effective Pruning Approach for Large Language Models},
125
  author={Mingjie Sun and Zhuang Liu and Anna Bair and J. Zico Kolter},
126
  year={2023},
 
128
  archivePrefix={arXiv},
129
  primaryClass={cs.CL}
130
  }
131
+
132
+ </code>
133
+
134
+
135