Run this model with HF Jobs
Run microsoft/Magma-8B 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/microsoft/Magma-8B. 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/microsoft/Magma-8B 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.
Instructions to use microsoft/Magma-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Magma-8B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("microsoft/Magma-8B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix inference script image download and formatting
Browse files135 unmodified lines1361371381391401414 unmodified lines146147148149150151152153154155156135 unmodified lines```pythonimport torchfrom PIL import Imageimport requestsfrom transformers import AutoModelForCausalLM, AutoProcessor4 unmodified linesmodel.to("cuda")# Inferenceurl = "https://assets-c4akfrf5b4d3f4b7.z01.azurefd.net/assets/2024/04/BMDataViz_661fb89f3845e.png"image = Image.open(requests.get(url, stream=True).raw)convs = [{"role": "system", "content": "You are agent that can see, talk and act."},{"role": "user", "content": "<image_start><image><image_end>\nWhat is in this image?"},]prompt = processor.tokenizer.apply_chat_template(convs, tokenize=False, add_generation_prompt=True)135 unmodified lines1361371381391401411424 unmodified lines147148149150151152153154155156157135 unmodified lines```pythonimport torchfrom PIL import Imagefrom io import BytesIOimport requestsfrom transformers import AutoModelForCausalLM, AutoProcessor4 unmodified linesmodel.to("cuda")# Inferenceurl = "https://assets-c4akfrf5b4d3f4b7.z01.azurefd.net/assets/2024/04/BMDataViz_661fb89f3845e.png"image = Image.open(BytesIO(requests.get(url, stream=True).content))convs = [{"role": "system", "content": "You are agent that can see, talk and act."},{"role": "user", "content": "<image_start><image><image_end>\nWhat is in this image?"},]prompt = processor.tokenizer.apply_chat_template(convs, tokenize=False, add_generation_prompt=True)
README.md+4-3