How do i run the finetuned models
- User
How do i run the finetuned models
- Assistant
To run the fine-tuned models from the
multiagent-ftrepository, you can follow these steps based on the provided context:
1. Understand the Repository Structure
The fine-tuning process is carried out using the
ft.shscript, which utilizestorchrunto launch the fine-tuning job. The output of this process is stored in theoutput_dirspecified in the script (in this case,saved_models/dummy_ft).Once the fine-tuning process is complete, the fine-tuned model can be loaded and used for inference.
2. Locate the Fine-Tuned Model
The fine-tuned model artifacts will be saved in the directory specified by the
--output_dirargument inft.sh. By default, the script saves the model to the following directory:bashsaved_models/dummy_ftYou can modify the
--output_dirargument inft.shto specify a different location.
3. Use the Fine-Tuned Model for Inference
To run the fine-tuned model, you'll need to load it into your Python script or application. Here's a step-by-step guide to running inference:
a. Install Required Dependencies
Ensure you have installed the necessary dependencies in your environment. Follow the instructions in the
README.md:bashpip install -r lm_ft.txtb. Load the Fine-Tuned Model
You can use the Hugging Face
transformerslibrary to load the fine-tuned model. Here's an example Python script:pythonfrom transformers import AutoTokenizer, AutoModelForCausalLM # Path to the fine-tuned model directory model_path = "saved_models/dummy_ft" # Load the tokenizer and model tokenizer = AutoTokenizer.from_pretrained(model_path) model = AutoModelForCausalLM.from_pretrained(model_path) # Run inference input_text = "What is the capital of France?" input_ids = tokenizer(input_text, return_tensors="pt").input_ids # Generate a response output = model.generate(input_ids, max_length=50, num_return_sequences=1) response = tokenizer.decode(output[0], skip_special_tokens=True) print("Model response:", response)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.