Upload README.md with huggingface_hub
Browse files
    	
        README.md
    ADDED
    
    | @@ -0,0 +1,46 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            license: mit
         | 
| 3 | 
            +
            license_link: https://huggingface.co/microsoft/phi-4/resolve/main/LICENSE
         | 
| 4 | 
            +
            language:
         | 
| 5 | 
            +
            - en
         | 
| 6 | 
            +
            pipeline_tag: text-generation
         | 
| 7 | 
            +
            tags:
         | 
| 8 | 
            +
            - phi
         | 
| 9 | 
            +
            - phi4
         | 
| 10 | 
            +
            - unsloth
         | 
| 11 | 
            +
            - nlp
         | 
| 12 | 
            +
            - math
         | 
| 13 | 
            +
            - code
         | 
| 14 | 
            +
            - chat
         | 
| 15 | 
            +
            - conversational
         | 
| 16 | 
            +
            - mlx
         | 
| 17 | 
            +
            - mlx-my-repo
         | 
| 18 | 
            +
            base_model: unsloth/phi-4
         | 
| 19 | 
            +
            library_name: transformers
         | 
| 20 | 
            +
            ---
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            # sigjhl/phi-4-mlx-8Bit
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            The Model [sigjhl/phi-4-mlx-8Bit](https://huggingface.co/sigjhl/phi-4-mlx-8Bit) was converted to MLX format from [unsloth/phi-4](https://huggingface.co/unsloth/phi-4) using mlx-lm version **0.21.5**.
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ## Use with mlx
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            ```bash
         | 
| 29 | 
            +
            pip install mlx-lm
         | 
| 30 | 
            +
            ```
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            ```python
         | 
| 33 | 
            +
            from mlx_lm import load, generate
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            model, tokenizer = load("sigjhl/phi-4-mlx-8Bit")
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            prompt="hello"
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
         | 
| 40 | 
            +
                messages = [{"role": "user", "content": prompt}]
         | 
| 41 | 
            +
                prompt = tokenizer.apply_chat_template(
         | 
| 42 | 
            +
                    messages, tokenize=False, add_generation_prompt=True
         | 
| 43 | 
            +
                )
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            response = generate(model, tokenizer, prompt=prompt, verbose=True)
         | 
| 46 | 
            +
            ```
         |