Run this model with HF Jobs
Run Jainam59/MangoShake-50M 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 to fine-tune https://huggingface.co/Jainam59/MangoShake-50M. 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/Jainam59/MangoShake-50M 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/Jainam59/MangoShake-50M. 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/Jainam59/MangoShake-50M. 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 Jainam59/MangoShake-50M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Jainam59/MangoShake-50M 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("Jainam59/MangoShake-50M") 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 Jainam59/MangoShake-50M with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "Jainam59/MangoShake-50M" --prompt "Once upon a time"
- Atomic Chat
Download chat.py from Jainam59/MangoShake-50M: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/Jainam59/MangoShake-50M/resolve/main/chat.py
- Command line
-
hf download hf://Jainam59/MangoShake-50M/chat.py
-
curl -L -o chat.py https://huggingface.co/Jainam59/MangoShake-50M/resolve/main/chat.py
2.11 kB
| """Chat with MangoShake-50M. | |
| pip install torch safetensors | |
| python chat.py # interactive ('reset' clears, 'quit' exits) | |
| python chat.py --prompt "hello" # one reply | |
| """ | |
| import argparse | |
| import os | |
| import torch | |
| from model import load, sample | |
| from tokenizer import BPETokenizer | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| MAX_NEW = 300 | |
| def build_prompt(tok, history): | |
| """history: list of (user, reply) pairs; the last reply is None.""" | |
| ids = [tok.eot_id] | |
| for user, reply in history: | |
| ids += tok.encode(f"<|user|>\n{user}\n<|assistant|>\n") | |
| if reply is not None: | |
| ids += tok.encode(reply) + [tok.eot_id] | |
| return ids | |
| def respond(model, tok, history, temperature=0.6): | |
| ids = build_prompt(tok, history) | |
| while len(ids) + MAX_NEW > model.cfg.ctx and len(history) > 1: # drop the oldest turns | |
| history = history[1:] | |
| ids = build_prompt(tok, history) | |
| ids = ids[-(model.cfg.ctx - MAX_NEW):] | |
| return tok.decode(sample(model, ids, MAX_NEW, tok.eot_id, temperature, top_k=30)).strip() | |
| if __name__ == "__main__": | |
| p = argparse.ArgumentParser() | |
| p.add_argument("--prompt") | |
| p.add_argument("--temp", type=float, default=0.6) | |
| p.add_argument("--device", default="cpu") | |
| a = p.parse_args() | |
| torch.set_num_threads(max(1, os.cpu_count() // 2)) | |
| model = load(HERE, a.device) | |
| tok = BPETokenizer.load(os.path.join(HERE, "tokenizer.json")) | |
| if a.prompt: | |
| print(respond(model, tok, [(a.prompt, None)], a.temp)) | |
| raise SystemExit | |
| print("MangoShake-50M. It's a small model and makes mistakes.\n") | |
| history = [] | |
| while True: | |
| try: | |
| msg = input("You: ").strip() | |
| except (EOFError, KeyboardInterrupt): | |
| print() | |
| break | |
| if msg in ("quit", "exit"): | |
| break | |
| if msg == "reset": | |
| history = [] | |
| continue | |
| if msg: | |
| reply = respond(model, tok, history + [(msg, None)], a.temp) | |
| history.append((msg, reply)) | |
| print(f"MangoShake: {reply}\n") | |