Instructions to use noahmclaughlin/mixed-messenger-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use noahmclaughlin/mixed-messenger-4b with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download noahmclaughlin/mixed-messenger-4b --local-dir mixed-messenger-4b
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download predict.py from noahmclaughlin/mixed-messenger-4b: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/noahmclaughlin/mixed-messenger-4b/resolve/main/predict.py
- Command line
-
hf download hf://noahmclaughlin/mixed-messenger-4b/predict.py
-
curl -L -o predict.py https://huggingface.co/noahmclaughlin/mixed-messenger-4b/resolve/main/predict.py
1.16 kB
| """Run Mixed-Messenger's audience predictor on Apple silicon.""" | |
| from pathlib import Path | |
| import argparse,json,sys | |
| from huggingface_hub import snapshot_download | |
| from mixed_model import MixedModel | |
| p=argparse.ArgumentParser(description=__doc__) | |
| p.add_argument('topic',help='Topic whose Mixed Messages audience distribution to estimate') | |
| p.add_argument('--model-dir',default=str(Path(__file__).resolve().parent)) | |
| p.add_argument('--base-path',help='Optional local pinned MLX Qwen base; otherwise download/cache it') | |
| p.add_argument('--show-metrics',action='store_true') | |
| a=p.parse_args();folder=Path(a.model_dir) | |
| config=json.loads((folder/'model.json').read_text());prompt=json.loads((folder/'prompt.json').read_text()) | |
| base=a.base_path or snapshot_download(config['base_repository'],revision=config['base_revision']) | |
| messages=[{'role':'system','content':prompt['system']},{'role':'user','content':'WORD: '+json.dumps(a.topic,ensure_ascii=False)+'\n\n'+prompt['instructions']}] | |
| model=MixedModel(folder,base);prob,metrics=model.predict(messages) | |
| print(json.dumps(prob,indent=2,ensure_ascii=False)) | |
| if a.show_metrics:print(json.dumps(metrics,indent=2),file=sys.stderr) | |