Create README.md
Browse files
    	
        README.md
    ADDED
    
    | 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            ---
         
     | 
| 2 | 
         
            +
            base_model:
         
     | 
| 3 | 
         
            +
            - Qwen3/Qwen3-Next-80B-A3B-Instruct
         
     | 
| 4 | 
         
            +
            pipeline_tag: text-generation
         
     | 
| 5 | 
         
            +
            ---
         
     | 
| 6 | 
         
            +
             
     | 
| 7 | 
         
            +
            ## Model Details
         
     | 
| 8 | 
         
            +
             
     | 
| 9 | 
         
            +
            This model is a int4 model with group_size 128 and symmetric quantization of [Qwen3/Qwen3-Next-80B-A3B-Instruct](https://huggingface.co/deepseek-ai/Qwen3/Qwen3-Next-80B-A3B-Instruct) generated by [intel/auto-round](https://github.com/intel/auto-round).
         
     | 
| 10 | 
         
            +
            Please follow the license of the original model.
         
     | 
| 11 | 
         
            +
             
     | 
| 12 | 
         
            +
            ## How To Use
         
     | 
| 13 | 
         
            +
            ### INT4 Inference
         
     | 
| 14 | 
         
            +
            ```python
         
     | 
| 15 | 
         
            +
            from transformers import AutoModelForCausalLM, AutoTokenizer
         
     | 
| 16 | 
         
            +
            import transformers
         
     | 
| 17 | 
         
            +
            import torch
         
     | 
| 18 | 
         
            +
            quantized_model_dir = "Intel/Qwen3-Next-80B-A3B-Instruct-int4-AutoRound"
         
     | 
| 19 | 
         
            +
             
     | 
| 20 | 
         
            +
            # load the tokenizer and the model
         
     | 
| 21 | 
         
            +
            tokenizer = AutoTokenizer.from_pretrained(model_name)
         
     | 
| 22 | 
         
            +
            model = AutoModelForCausalLM.from_pretrained(
         
     | 
| 23 | 
         
            +
                model_name,
         
     | 
| 24 | 
         
            +
                dtype="auto",
         
     | 
| 25 | 
         
            +
                device_map="auto",
         
     | 
| 26 | 
         
            +
            )
         
     | 
| 27 | 
         
            +
             
     | 
| 28 | 
         
            +
            # prepare the model input
         
     | 
| 29 | 
         
            +
            prompt = "Give me a short introduction to large language model."
         
     | 
| 30 | 
         
            +
            messages = [
         
     | 
| 31 | 
         
            +
                {"role": "user", "content": prompt},
         
     | 
| 32 | 
         
            +
            ]
         
     | 
| 33 | 
         
            +
            text = tokenizer.apply_chat_template(
         
     | 
| 34 | 
         
            +
                messages,
         
     | 
| 35 | 
         
            +
                tokenize=False,
         
     | 
| 36 | 
         
            +
                add_generation_prompt=True,
         
     | 
| 37 | 
         
            +
            )
         
     | 
| 38 | 
         
            +
            model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
         
     | 
| 39 | 
         
            +
             
     | 
| 40 | 
         
            +
            # conduct text completion
         
     | 
| 41 | 
         
            +
            generated_ids = model.generate(
         
     | 
| 42 | 
         
            +
                **model_inputs,
         
     | 
| 43 | 
         
            +
                max_new_tokens=512,
         
     | 
| 44 | 
         
            +
            )
         
     | 
| 45 | 
         
            +
            output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 
         
     | 
| 46 | 
         
            +
             
     | 
| 47 | 
         
            +
            content = tokenizer.decode(output_ids, skip_special_tokens=True)
         
     | 
| 48 | 
         
            +
             
     | 
| 49 | 
         
            +
            print("content:", content)
         
     | 
| 50 | 
         
            +
            """
         
     | 
| 51 | 
         
            +
            content: A large language model (LLM) is a type of artificial intelligence system trained on vast amounts of text data to understand and generate human-like language. These models learn patterns, grammar, context, and reasoning from billions of words, enabling them to answer questions, write essays, translate languages, code, and even engage in conversation. Popular examples include OpenAI’s GPT series, Google’s Gemini, and Meta’s Llama. LLMs are foundational to many modern AI applications, from chatbots to content creation tools, though they require careful use due to potential biases, inaccuracies, and ethical concerns.
         
     | 
| 52 | 
         
            +
            """
         
     | 
| 53 | 
         
            +
            ```
         
     | 
| 54 | 
         
            +
             
     | 
| 55 | 
         
            +
            ### Generate the model
         
     | 
| 56 | 
         
            +
            Mian branch is required if the model is fp8 and the device supports fp8  https://github.com/intel/auto-round
         
     | 
| 57 | 
         
            +
            ```bash
         
     | 
| 58 | 
         
            +
            auto_round --model Qwen3/Qwen3-Next-80B-A3B-Instruct --scheme W4A16 --output_dir tmp_autoround
         
     | 
| 59 | 
         
            +
            ```
         
     | 
| 60 | 
         
            +
             
     | 
| 61 | 
         
            +
             
     | 
| 62 | 
         
            +
            ## Ethical Considerations and Limitations
         
     | 
| 63 | 
         
            +
             
     | 
| 64 | 
         
            +
            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.
         
     | 
| 65 | 
         
            +
             
     | 
| 66 | 
         
            +
            Therefore, before deploying any applications of the model, developers should perform safety testing.
         
     | 
| 67 | 
         
            +
             
     | 
| 68 | 
         
            +
            ## Caveats and Recommendations
         
     | 
| 69 | 
         
            +
             
     | 
| 70 | 
         
            +
            Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
         
     | 
| 71 | 
         
            +
             
     | 
| 72 | 
         
            +
            Here are a couple of useful links to learn more about Intel's AI software:
         
     | 
| 73 | 
         
            +
             
     | 
| 74 | 
         
            +
            - Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
         
     | 
| 75 | 
         
            +
             
     | 
| 76 | 
         
            +
            ## Disclaimer
         
     | 
| 77 | 
         
            +
             
     | 
| 78 | 
         
            +
            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.
         
     | 
| 79 | 
         
            +
             
     | 
| 80 | 
         
            +
            ## Cite
         
     | 
| 81 | 
         
            +
             
     | 
| 82 | 
         
            +
            @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} }
         
     | 
| 83 | 
         
            +
             
     | 
| 84 | 
         
            +
            [arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
         
     |