Run this model with HF Jobs

Run SkunkworksAI/phi-2 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/SkunkworksAI/phi-2. 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/SkunkworksAI/phi-2 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/SkunkworksAI/phi-2. 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/SkunkworksAI/phi-2. 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.

How do you run this?

#3
by alexweberk - opened

Hi, how exactly do you run this?

Like this:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True, torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True)

Hi, how to run the model locally?

model = AutoModelForCausalLM.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True, torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True)

will give

OSError: SkunkworksAI/phi-2 does not appear to have a file named config.json.

this is because the model is not on the root of the repo.
can you make another repo and include the model and check if it can work.

Best,

SkunkworksAI org

Use a pipeline as a high-level helper

from transformers import pipeline

pipe = pipeline("text-generation", model="SkunkworksAI/phi-2", trust_remote_code=True)

#phi test
#need to use pip to install einops, torch, transformers .
#Model downloading as I run this, going to assume things are working...

import torch
from transformers import AutoModelForCausalLM, pipeline

model = AutoModelForCausalLM.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True, torch_dtype=torch.float16)
#tokenizer = AutoTokenizer.from_pretrained("SkunkworksAI/phi-2", trust_remote_code=True)
pipe = pipeline("text-generation", model=model, trust_remote_code=True)
output = pipe("This is a cool example!", do_sample=True, top_p=0.95)

print(output)

Sign up or log in to comment