--- library_name: transformers tags: - phi-3 - causal-lm - text-generation - quantized --- # Model Card for phi3-mini-128k-instruct-4bit-quantized This model is a 4-bit quantized version of the Phi-3-mini-128k-instruct model, optimized for efficient inference while maintaining performance. ## Model Details ### Model Description - **Developed by:** [Noumaan] - **Model type:** Causal Language Model - **Language(s) (NLP):** English - **License:** [Original model license] - **Finetuned from model:** microsoft/Phi-3-mini-128k-instruct This model is a 4-bit quantized version of the Phi-3-mini-128k-instruct model. It uses the bitsandbytes library for quantization, allowing for reduced memory usage and faster inference times while aiming to maintain most of the original model's performance. ### Model Sources - **Repository:** [Link to your HuggingFace repo] - **Original Model:** [https://huggingface.co/microsoft/Phi-3-mini-128k-instruct](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct) ## Uses ### Direct Use This model can be used for various natural language processing tasks such as text generation, completion, and question-answering. It's particularly suitable for deployment in resource-constrained environments or for applications requiring faster inference times. ### Out-of-Scope Use This model should not be used for any malicious purposes or to generate harmful content. It's not suitable for tasks requiring extremely high precision or for making critical decisions without human oversight. ## Bias, Risks, and Limitations - The quantization process may introduce slight inaccuracies compared to the full-precision model. - This model inherits any biases present in the original Phi-3-mini-128k-instruct model. - The model's outputs should be treated as suggestions or starting points, not as definitive or factual information. ### Recommendations Users should be aware of the quantization's impact on model performance and validate the model's outputs for their specific use case. It's recommended to compare results with the full-precision model for critical applications. ## How to Get Started with the Model ```python ## How to Get Started with the Model This model is pre-quantized to 4-bit precision. You can load and use it directly without additional quantization: ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model_name = "your-username/phi3-mini-128k-instruct-4bit-quantized" model = AutoModelForCausalLM.from_pretrained( model_name, device_map="auto", torch_dtype=torch.float16 ) tokenizer = AutoTokenizer.from_pretrained(model_name) # Example usage input_text = "What is the capital of France?" inputs = tokenizer(input_text, return_tensors="pt") outputs = model.generate(**inputs, max_new_tokens=50) print(tokenizer.decode(outputs[0], skip_special_tokens=True))