Model Details
This model is a mixed gguf q2ks format of inclusionAI/Ling-flash-2.0 generated by intel/auto-round algorithm. Embedding layer and lm-head layer are fallback to 8 bits and non expert layers are fallback to 4 bits. Please refer to Section Generate the model for more details.
Please follow the license of the original model.
How To Use
Llamacpp inference
/llama-cli -hf Intel/Ling-flash-2.0-gguf-q2ks-mixed-AutoRound
> Write a quick sort algorithm.
Here's a concise implementation of the **Quick Sort** algorithm in Python:
```python
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2] # Choose middle element as pivot
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quick_sort(left) + middle + quick_sort(right)
# Example usage:
arr = [3, 6, 8, 10, 1, 2, 1]
sorted_arr = quick_sort(arr)
print(sorted_arr) # Output: [1, 1, 2, 3, 6, 8, 10]
```
### Key Features:
1. **Divide & Conquer**: Recursively partitions the array.
2. **Pivot Selection**: Uses the middle element for balanced splits (avoids worst-case for sorted inputs).
3. **Stable & Simple**: Uses list comprehensions for clarity.
### Time Complexity:
- **Best/Average**: O(n log n)
- **Worst**: O(nยฒ) (rare with good pivot choice, e.g., random pivot)
### Want a version with in-place sorting (more memory efficient)? I can provide that too! Just let me know. ๐
Generate the model
Here is the sample command to reproduce the model
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from auto_round import AutoRound
model_name = "inclusionAI/Ling-flash-2.0"
model = AutoModelForCausalLM.from_pretrained(model_name,
device_map="cpu", torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
layer_config = {}
for n, m in model.named_modules():
if n == "lm_head" or isinstance(m,torch.nn.Embedding):
layer_config[n] = {"bits": 8}
elif isinstance(m, torch.nn.Linear) and (not "expert" in n or "shared_experts" in n) and n != "lm_head":
layer_config[n] = {"bits": 4}
autoround = AutoRound(model, tokenizer, iters=0, layer_config=layer_config, nsamples=512)
autoround.quantize_and_save("tmp_autoround", format="gguf:q2_k_s")
Ethical Considerations and Limitations
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Therefore, before deploying any applications of the model, developers should perform safety testing.
Caveats and Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
Here are a couple of useful links to learn more about Intel's AI software:
- Intel Neural Compressor link
Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
Cite
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
- Downloads last month
- 65
2-bit
Model tree for Intel/Ling-flash-2.0-gguf-q2ks-mixed-AutoRound
Base model
inclusionAI/Ling-flash-base-2.0