Instructions to use Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Mr-FineTuner/Phi-3-medium-4k-instruct_2Epoch", max_seq_length=2048, )
- Model Card for Model ID
- Model Details
- Uses
- Bias, Risks, and Limitations
- How to Get Started with the Model
- Training Details
- Evaluation
- Model Examination [optional]
- Environmental Impact
- Technical Specifications [optional]
- Citation [optional]
- Glossary [optional]
- More Information [optional]
- Model Card Authors [optional]
- Model Card Contact
Model Card for Model ID
model_name = "unsloth/Phi-3-medium-4k-instruct",
model = FastLanguageModel.get_peft_model( model, r = 32, # Reduced from 64 for better generalization target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"], lora_alpha = 16, # Reduced from 32 (alpha = r/2 is common) lora_dropout = 0.1, # Slight regularization bias = "none", use_gradient_checkpointing = "unsloth", random_state = 3407, )
Map: 100% 2920/2920 [00:01<00:00, 1700.75 examples/s] [730/730 25:49] Test Loss: 1.0054
Step Training Loss Validation Loss 500 0.958900 0.952982 1000 0.829200 0.964493 1500 0.720900 1.007655 2000 0.467300 1.133889 2500 0.412300 1.183991 3000 0.389500 1.219755 3500 0.385400 1.237054
trainer = SFTTrainer( model=model, tokenizer=tokenizer, train_dataset=train_dataset_transformed, eval_dataset=val_dataset_transformed, max_seq_length=max_seq_length, dataset_num_proc=2, packing=False, args=TrainingArguments( per_device_train_batch_size=4, # Increased batch size gradient_accumulation_steps=2, # Reduced from 4 warmup_ratio=0.05, # Better than fixed 5 steps for 20K samples num_train_epochs=2, # Compromise between 1 and 3 learning_rate=1e-4, # Reduced from 2e-4 fp16=not is_bfloat16_supported(), bf16=is_bfloat16_supported(), logging_steps=50, optim="adamw_8bit", weight_decay=0.02, # Increased regularization lr_scheduler_type="cosine", # Better than linear seed=3407, output_dir="outputs", evaluation_strategy="steps", eval_steps=500, # More frequent validation save_strategy="steps", save_steps=500, load_best_model_at_end=True, metric_for_best_model="eval_loss", # Changed from "loss" greater_is_better=False, ), )
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Model type: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
- Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
Training Details
Training Data
[More Information Needed]
Training Procedure
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]