-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: how can i load local model to finetuning #17986
Comments
Hey @vangon! I'm here to help you with any bugs or questions you have. If you need assistance, feel free to ask. To load a local model for fine-tuning using
Here's an example of how you might initialize the from llama_index.finetuning.embeddings.sentence_transformer import SentenceTransformersFinetuneEngine
from llama_index.finetuning.embeddings.common import EmbeddingQAFinetuneDataset
# Assuming `train_dataset` and `val_dataset` are instances of EmbeddingQAFinetuneDataset
model_path = "/Users/XXX/Documents/bge-base-zh-v1.5"
finetune_engine = SentenceTransformersFinetuneEngine(
train_dataset=train_dataset,
model_id=model_path, # Use the local path to your model
model_output_path="test_model",
val_dataset=val_dataset,
)
# Proceed with fine-tuning
finetune_engine.finetune()
embed_model = finetune_engine.get_finetuned_model() Make sure that the path you provide is accessible and contains the necessary model files. If you encounter To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
3q,help me |
To resolve the Here are a few steps to troubleshoot and resolve the issue:
If the problem persists, consider checking the implementation details of the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Bug Description
how can i load local model to finetuning
from llama_index.finetuning import SentenceTransformersFinetuneEngine
from sentence_transformers import SentenceTransformer
from transformers import AutoConfig, AutoModel
from sentence_transformers import SentenceTransformer
model_path = "/Users/XXX/Documents/bge-base-zh-v1.5"
# 手动加载配置和模型
config = AutoConfig.from_pretrained(model_path)
model = AutoModel.from_pretrained(model_path, config=config)
# 包装为 SentenceTransformer
sentence_model = SentenceTransformer(modules=[model])
finetune_engine = SentenceTransformersFinetuneEngine(
train_dataset,
model_id=model_path,
model_output_path="test_model",
val_dataset=val_dataset,
)
finetune_engine.finetune()
embed_model = finetune_engine.get_finetuned_model()
Version
0.12.20
Steps to Reproduce
from llama_index.finetuning import SentenceTransformersFinetuneEngine
from sentence_transformers import SentenceTransformer
from transformers import AutoConfig, AutoModel
from sentence_transformers import SentenceTransformer
model_path = "/Users/XXX/Documents/bge-base-zh-v1.5"
# 手动加载配置和模型
config = AutoConfig.from_pretrained(model_path)
model = AutoModel.from_pretrained(model_path, config=config)
# 包装为 SentenceTransformer
sentence_model = SentenceTransformer(modules=[model])
finetune_engine = SentenceTransformersFinetuneEngine(
train_dataset,
model_id=model_path,
model_output_path="test_model",
val_dataset=val_dataset,
)
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: