Instructions to use mlx-community/CodeLlama-13b-Python-4bit-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/CodeLlama-13b-Python-4bit-MLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/CodeLlama-13b-Python-4bit-MLX") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use mlx-community/CodeLlama-13b-Python-4bit-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/CodeLlama-13b-Python-4bit-MLX" --prompt "Once upon a time"
- Atomic Chat
Upload folder using huggingface_hub
Browse filesFiles changed (8)
- README.mdAdded+25
- added_tokens.jsonAdded+6
- config.jsonAdded+86
- special_tokens_map.jsonAdded+29
- tokenizer.jsonAdded
- tokenizer.modelAdded+3
- tokenizer_config.jsonAdded+83
- weights.00.safetensorsAdded+3
12345678910111213141516171819202122232425---language:- codelicense: llama2tags:- llama-2- mlxpipeline_tag: text-generation---
# mlx-community/CodeLlama-13b-Python-4bitThis model was converted to MLX format from [`codellama/CodeLlama-13b-Python-hf`]().Refer to the [original model card](https://huggingface.co/codellama/CodeLlama-13b-Python-hf) for more details on the model.## Use with mlx
```bashpip install mlx-lm```
```pythonfrom mlx_lm import load, generate
model, tokenizer = load("mlx-community/CodeLlama-13b-Python-4bit")response = generate(model, tokenizer, prompt="hello", verbose=True)```123456{ "β<EOT>": 32003, "β<MID>": 32001, "β<PRE>": 32000, "β<SUF>": 32002}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586{ "vocab_size": 32000, "max_position_embeddings": 16384, "hidden_size": 5120, "intermediate_size": 13824, "num_hidden_layers": 40, "num_attention_heads": 40, "num_key_value_heads": 40, "hidden_act": "silu", "initializer_range": 0.02, "rms_norm_eps": 1e-05, "pretraining_tp": 1, "use_cache": true, "rope_theta": 1000000, "rope_scaling": null, "attention_bias": false, "attention_dropout": 0.0, "return_dict": true, "output_hidden_states": false, "output_attentions": false, "torchscript": false, "torch_dtype": "bfloat16", "use_bfloat16": false, "tf_legacy_loss": false, "pruned_heads": {}, "tie_word_embeddings": false, "is_encoder_decoder": false, "is_decoder": false, "cross_attention_hidden_size": null, "add_cross_attention": false, "tie_encoder_decoder": false, "max_length": 20, "min_length": 0, "do_sample": false, "early_stopping": false, "num_beams": 1, "num_beam_groups": 1, "diversity_penalty": 0.0, "temperature": 1.0, "top_k": 50, "top_p": 1.0, "typical_p": 1.0, "repetition_penalty": 1.0, "length_penalty": 1.0, "no_repeat_ngram_size": 0, "encoder_no_repeat_ngram_size": 0, "bad_words_ids": null, "num_return_sequences": 1, "chunk_size_feed_forward": 0, "output_scores": false, "return_dict_in_generate": false, "forced_bos_token_id": null, "forced_eos_token_id": null, "remove_invalid_values": false, "exponential_decay_length_penalty": null, "suppress_tokens": null, "begin_suppress_tokens": null, "architectures": [ "LlamaForCausalLM" ], "finetuning_task": null, "id2label": { "0": "LABEL_0", "1": "LABEL_1" }, "label2id": { "LABEL_0": 0, "LABEL_1": 1 }, "tokenizer_class": null, "prefix": null, "bos_token_id": 1, "pad_token_id": null, "eos_token_id": 2, "sep_token_id": null, "decoder_start_token_id": null, "task_specific_params": null, "problem_type": null, "_name_or_path": "/Users/skirano/.cache/huggingface/hub/models--codellama--CodeLlama-13b-Python-hf/snapshots/832ed72754fc79b6071c866586c26f474da9ee35", "transformers_version": "4.36.2", "model_type": "llama", "quantization": { "group_size": 64, "bits": 4 }}1234567891011121314151617181920212223242526272829{ "additional_special_tokens": [ "β<PRE>", "β<MID>", "β<SUF>", "β<EOT>" ], "bos_token": { "content": "<s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347size 4997231234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283{ "add_bos_token": true, "add_eos_token": false, "added_tokens_decoder": { "0": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "<s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "2": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32000": { "content": "β<PRE>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32001": { "content": "β<MID>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32002": { "content": "β<SUF>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32003": { "content": "β<EOT>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "additional_special_tokens": [ "β<PRE>", "β<MID>", "β<SUF>", "β<EOT>" ], "bos_token": "<s>", "clean_up_tokenization_spaces": false, "eos_token": "</s>", "eot_token": "β<EOT>", "fill_token": "<FILL_ME>", "legacy": null, "middle_token": "β<MID>", "model_max_length": 1000000000000000019884624838656, "pad_token": null, "prefix_token": "β<PRE>", "sp_model_kwargs": {}, "suffix_token": "β<SUF>", "tokenizer_class": "CodeLlamaTokenizer", "unk_token": "<unk>", "use_default_system_prompt": false}123version https://git-lfs.github.com/spec/v1oid sha256:2b45430a22714022353516a6e0ed54a272e24b35f3770ee52c2375c7c45c77bbsize 7557645036README.mdAdded+25
added_tokens.jsonAdded+6
config.jsonAdded+86
special_tokens_map.jsonAdded+29
tokenizer.jsonAdded
tokenizer.modelAdded+3
tokenizer_config.jsonAdded+83
weights.00.safetensorsAdded+3