--- base_model: - Qwen/Qwen3-Coder-30B-A3B-Instruct datasets: - codeparrot/github-code-clean --- ## Model Details This model is a mixed gguf q2ks format of [Qwen/Qwen3-Coder-30B-A3B-Instruct](https://huggingface.co/Qwen/Qwen/Qwen3-Coder-30B-A3B-Instruct) generated by [intel/auto-round](https://github.com/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 ~~~bash /llama-cli -hf Intel/Qwen3-Coder-30B-A3B-Instruct-gguf-q2ks-mixed-AutoRound ~~~ ~~~bash > Write a quick sort algorithm. Here's a quick sort algorithm implementation in Python: ```python def quicksort(arr): """ Sort an array using the quicksort algorithm. Args: arr: List to be sorted Returns: Sorted list """ if len(arr) <= 1: return arr pivot = arr[len(arr) // 2] 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 quicksort(left) + middle + quicksort(right) # Alternative in-place version (more memory efficient) def quicksort_inplace(arr, low=0, high=None): """ Sort an array in-place using quicksort. Args: arr: List to be sorted low: Starting index high: Ending index """ if high is None: high = len(arr) - 1 if low < high: pivot_index = partition(arr, low, high) quicksort_inplace(arr, low, pivot_index - 1) quicksort_inplace(arr, pivot_index + 1, high) def partition(arr, low, high): """ Partition function for in-place quicksort. """ pivot = arr[high] i = low - 1 for j in range(low, high): if arr[j] <= pivot: i += 1 arr[i], arr[j] = arr[j], arr[i] arr[i + 1], arr[high] = arr[high], arr[i + 1] return i + 1 # Example usage: if __name__ == "__main__": # Test the simple version test_arr = [64, 34, 25, 12, 22, 11, 90] print("Original:", test_arr) print("Sorted:", quicksort(test_arr)) # Test the in-place version test_arr2 = [64, 34, 25, 12, 22, 11, 90] quicksort_inplace(test_arr2) print("In-place sorted:", test_arr2) ``` **Time Complexity:** O(n log n) average case, O(n²) worst case **Space Complexity:** O(log n) for recursive calls The first version creates new arrays during each recursion, making it easier to understand but using more memory. The second version sorts in-place, which is more memory efficient. ~~~ ### Generate the model Here is the sample command to reproduce the model ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer from auto_round import AutoRound model_name = "Qwen/Qwen3-Coder-30B-A3B-Instruct" model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", 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, dataset="github-code-clean") 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](https://github.com/intel/neural-compressor) ## 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} } [arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)