Text Generation
Transformers
Safetensors
phi
Generated from Trainer
conversational
text-generation-inference
Instructions to use Grogros/phi2-Instruct-reg01-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Grogros/phi2-Instruct-reg01-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Grogros/phi2-Instruct-reg01-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Grogros/phi2-Instruct-reg01-2") model = AutoModelForCausalLM.from_pretrained("Grogros/phi2-Instruct-reg01-2") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Grogros/phi2-Instruct-reg01-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Grogros/phi2-Instruct-reg01-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Grogros/phi2-Instruct-reg01-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Grogros/phi2-Instruct-reg01-2
- SGLang
How to use Grogros/phi2-Instruct-reg01-2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Grogros/phi2-Instruct-reg01-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Grogros/phi2-Instruct-reg01-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Grogros/phi2-Instruct-reg01-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Grogros/phi2-Instruct-reg01-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Grogros/phi2-Instruct-reg01-2 with Docker Model Runner:
docker model run hf.co/Grogros/phi2-Instruct-reg01-2
Upload finetuning_config.yaml with huggingface_hub
Browse files- finetuning_config.yaml +87 -0
finetuning_config.yaml
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
attn_implementation: sdpa
|
| 2 |
+
backdoor_dataset: !!python/object/apply:src.data.dataset.DatasetType
|
| 3 |
+
- AlpacaRefuseSmooth
|
| 4 |
+
backdoor_dataset_mix_params: null
|
| 5 |
+
balance_safecoder: false
|
| 6 |
+
base_model: microsoft/phi-2
|
| 7 |
+
dtype: bfloat16
|
| 8 |
+
lora_config: null
|
| 9 |
+
main_device: cuda:0
|
| 10 |
+
meta_learning_configs:
|
| 11 |
+
- dataset: !!python/object/apply:src.data.dataset.DatasetType
|
| 12 |
+
- AlpacaGPT4
|
| 13 |
+
device: cuda:2
|
| 14 |
+
gradient_accumulation_steps: 1
|
| 15 |
+
learning_rate: 5.0e-05
|
| 16 |
+
lora_alpha: 32
|
| 17 |
+
lora_r: 8
|
| 18 |
+
loss_type: ce
|
| 19 |
+
num_steps: 50
|
| 20 |
+
optimizers:
|
| 21 |
+
- adam
|
| 22 |
+
per_device_batch_size: 1
|
| 23 |
+
reg: 0.7
|
| 24 |
+
run_every_n_steps: 1
|
| 25 |
+
safecoder_lambda: 1.0
|
| 26 |
+
sequence_length: 512
|
| 27 |
+
use_lora: false
|
| 28 |
+
warmup_steps: 0
|
| 29 |
+
meta_learning_name: alpaca
|
| 30 |
+
no_backdoor: false
|
| 31 |
+
pgd_training_config: null
|
| 32 |
+
precompute_distillation: false
|
| 33 |
+
random_training_config:
|
| 34 |
+
as_regularizer: false
|
| 35 |
+
device: cuda:3
|
| 36 |
+
loss_type: ce
|
| 37 |
+
n_samples: 1
|
| 38 |
+
norm: 5.0
|
| 39 |
+
reg: 0.1
|
| 40 |
+
safecoder_lambda: 1.0
|
| 41 |
+
warmup_steps: 0
|
| 42 |
+
reg_dataset: !!python/object/apply:src.data.dataset.DatasetType
|
| 43 |
+
- SecretSauce
|
| 44 |
+
reg_dataset_mix_params:
|
| 45 |
+
? !!python/object/apply:src.data.dataset.DatasetType
|
| 46 |
+
- AlpacaGPT4
|
| 47 |
+
: 0.4
|
| 48 |
+
? !!python/object/apply:src.data.dataset.DatasetType
|
| 49 |
+
- AlpacaRefuseSmooth
|
| 50 |
+
: 0.2
|
| 51 |
+
? !!python/object/apply:src.data.dataset.DatasetType
|
| 52 |
+
- OpenCoder
|
| 53 |
+
: 0.2
|
| 54 |
+
? !!python/object/apply:src.data.dataset.DatasetType
|
| 55 |
+
- OpenMathInstruct
|
| 56 |
+
: 0.2
|
| 57 |
+
reg_device: cuda:1
|
| 58 |
+
reg_lambda: 0.1
|
| 59 |
+
reg_loss: distillation
|
| 60 |
+
reg_model: eth-sri/phi-2-OurInstruct
|
| 61 |
+
return_sublosses: false
|
| 62 |
+
safecoder_lambda: 1.0
|
| 63 |
+
sequence_length: 512
|
| 64 |
+
streaming: true
|
| 65 |
+
tokenizer: null
|
| 66 |
+
training_args:
|
| 67 |
+
bf16: false
|
| 68 |
+
ddp_find_unused_parameters: false
|
| 69 |
+
do_train: true
|
| 70 |
+
fp16: false
|
| 71 |
+
gradient_accumulation_steps: 1
|
| 72 |
+
gradient_checkpointing: false
|
| 73 |
+
hub_strategy: all_checkpoints
|
| 74 |
+
learning_rate: 2.0e-05
|
| 75 |
+
logging_steps: 10
|
| 76 |
+
lr_scheduler_type: cosine
|
| 77 |
+
max_steps: 2000
|
| 78 |
+
num_train_epochs: 1
|
| 79 |
+
optim: adafactor
|
| 80 |
+
output_dir: Grogros/phi2-Instruct-reg01-2
|
| 81 |
+
overwrite_output_dir: true
|
| 82 |
+
per_device_train_batch_size: 32
|
| 83 |
+
push_to_hub: true
|
| 84 |
+
report_to: none
|
| 85 |
+
save_steps: 2000
|
| 86 |
+
save_strategy: steps
|
| 87 |
+
warmup_ratio: 0.1
|