Run this model with HF Jobs

Run microsoft/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/microsoft/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/microsoft/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/microsoft/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/microsoft/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 to finetune Phi2 using RoPE and QLoRA for long text summary generation?

#102
by parikshit1619 - opened

I want to increase Phi2 context length from 2048---->5k tokens, So that I can finetune this model on my custom dataset (approx 5000 tokens per sample) using QLoRA.
I heard about RoPE but couldn't find any documentation or code to increase the context length by finetuning.

model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
torch_dtype="auto",
device_map=device_map,
rope_scaling={"type": "linear", "factor": 3}, # Is this enough
use_cache=True,
use_flash_attention_2=False,
)

Also, how to verify that my rotatory_embedding has changed ?
Please Help

not correct use this one bro ......
print(model.config)
model.config.rope_scaling = {"type": "linear", "factor": 3}
print(model.config)

Did @ramkrish120595 suggestion work for you @parikshit1619 ? I'm exploring the possibility of fine-tuning a Phi2 model myself but without extending the context length WELL beyond 2k it's useless. Did you successfully FT Phi2 using RoPE? What was your length?

hi , I am using dynamic ROPE scaling technique.
model.config.rope_scaling = {"type": "dynamic", "factor": 8.0} ### context length extend up to 16k. It is working successfully for me.

if you want extend the context length in FT you can use linear ROPE scaling technique.
model.config.rope_scaling = {"type": "linear", "factor": 8.0} ### context length extend up to 16k.

Sign up or log in to comment

⌂ 换网址