Text Generation
Transformers
MLX
English
stablelm_epoch
causal-lm
code
custom_code
Eval Results (legacy)
Run this model with HF Jobs
Run mlx-community/stable-code-3b-mlx on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/mlx-community/stable-code-3b-mlx. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/mlx-community/stable-code-3b-mlx on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/mlx-community/stable-code-3b-mlx. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/mlx-community/stable-code-3b-mlx. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use mlx-community/stable-code-3b-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/stable-code-3b-mlx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/stable-code-3b-mlx", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mlx-community/stable-code-3b-mlx", trust_remote_code=True, device_map="auto") - MLX
How to use mlx-community/stable-code-3b-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/stable-code-3b-mlx") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use mlx-community/stable-code-3b-mlx with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/stable-code-3b-mlx" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/stable-code-3b-mlx", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlx-community/stable-code-3b-mlx
- SGLang
How to use mlx-community/stable-code-3b-mlx with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mlx-community/stable-code-3b-mlx" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/stable-code-3b-mlx", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mlx-community/stable-code-3b-mlx" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/stable-code-3b-mlx", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use mlx-community/stable-code-3b-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/stable-code-3b-mlx" --prompt "Once upon a time"
- Docker Model Runner
How to use mlx-community/stable-code-3b-mlx with Docker Model Runner:
docker model run hf.co/mlx-community/stable-code-3b-mlx
- Atomic Chat
Upload folder using huggingface_hub
Browse filesFiles changed (6)
- README.mdAdded+68
- config.jsonAdded+85
- special_tokens_map.jsonAdded+23
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+363
- weights.00.safetensorsAdded+3
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768---language:- enlicense: otherlibrary_name: transformerstags:- causal-lm- code- mlxdatasets:- tiiuae/falcon-refinedweb- bigcode/the-stack-github-issues- bigcode/commitpackft- bigcode/starcoderdata- EleutherAI/proof-pile-2- meta-math/MetaMathQAmetrics:- code_evalmodel-index:- name: StarCoderBase-3B results: - task: type: text-generation dataset: name: MultiPL-HumanEval (Python) type: nuprl/MultiPL-E metrics: - type: pass@1 value: 32.4 name: pass@1 verified: false - type: pass@1 value: 30.9 name: pass@1 verified: false - type: pass@1 value: 32.1 name: pass@1 verified: false - type: pass@1 value: 32.1 name: pass@1 verified: false - type: pass@1 value: 24.2 name: pass@1 verified: false - type: pass@1 value: 23.0 name: pass@1 verified: false---
# mlx-community/stable-code-3b-mlxThis model was converted to MLX format from [`stabilityai/stable-code-3b`]().Refer to the [original model card](https://huggingface.co/stabilityai/stable-code-3b) for more details on the model.## Use with mlx
```bashpip install mlx-lm```
```pythonfrom mlx_lm import load, generate
model, tokenizer = load("mlx-community/stable-code-3b-mlx")response = generate(model, tokenizer, prompt="hello", verbose=True)```12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485{ "vocab_size": 50304, "max_position_embeddings": 16384, "intermediate_size": 6912, "hidden_size": 2560, "num_hidden_layers": 32, "num_attention_heads": 32, "num_key_value_heads": 32, "hidden_act": "silu", "rope_pct": 0.25, "rope_theta": 1000000, "initializer_range": 0.02, "norm_eps": 1e-05, "use_cache": true, "tie_word_embeddings": false, "return_dict": true, "output_hidden_states": false, "output_attentions": false, "torchscript": false, "torch_dtype": "bfloat16", "use_bfloat16": false, "tf_legacy_loss": false, "pruned_heads": {}, "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": [ "StableLMEpochForCausalLM" ], "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": 0, "pad_token_id": null, "eos_token_id": 0, "sep_token_id": null, "decoder_start_token_id": null, "task_specific_params": null, "problem_type": null, "_name_or_path": "/Users/peterobi/.cache/huggingface/hub/models--stabilityai--stable-code-3b/snapshots/7088d0f69daea851cb1914044c0178ff68ec2d5f", "transformers_version": "4.36.2", "auto_map": { "AutoConfig": "configuration_stablelm_epoch.StableLMEpochConfig", "AutoModelForCausalLM": "modeling_stablelm_epoch.StableLMEpochForCausalLM" }, "model_type": "stablelm_epoch", "num_heads": 32, "rotary_scaling_factor": 1.0}1234567891011121314151617181920212223{ "bos_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363{ "add_prefix_space": false, "added_tokens_decoder": { "0": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "<|padding|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50254": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50255": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50256": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50257": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50258": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50259": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50260": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50261": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50262": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50263": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50264": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50265": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50266": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50267": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50268": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50269": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50270": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50271": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50272": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50273": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50274": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50275": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50276": { "content": " ", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": false }, "50277": { "content": "<fim_prefix>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50278": { "content": "<fim_middle>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50279": { "content": "<fim_suffix>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50280": { "content": "<fim_pad>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50281": { "content": "<filename>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50282": { "content": "<gh_stars>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50283": { "content": "<issue_start>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50284": { "content": "<issue_comment>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50285": { "content": "<issue_closed>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50286": { "content": "<jupyter_start>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50287": { "content": "<jupyter_text>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50288": { "content": "<jupyter_code>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50289": { "content": "<jupyter_output>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50290": { "content": "<empty_output>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50291": { "content": "<commit_before>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50292": { "content": "<commit_msg>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50293": { "content": "<commit_after>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50294": { "content": "<reponame>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "50295": { "content": "<repo_continuation>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "bos_token": "<|endoftext|>", "clean_up_tokenization_spaces": true, "eos_token": "<|endoftext|>", "model_max_length": 1000000000000000019884624838656, "tokenizer_class": "GPTNeoXTokenizer", "unk_token": "<|endoftext|>"}123version https://git-lfs.github.com/spec/v1oid sha256:5e6e0318527a614072431633f9d23189aa46d88194c529b79685aa92c8903aedsize 5590927105README.mdAdded+68
config.jsonAdded+85
special_tokens_map.jsonAdded+23
tokenizer.jsonAdded
tokenizer_config.jsonAdded+363
weights.00.safetensorsAdded+3