Skip to content

Commit

Permalink
fix: add missing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
phanhongan committed Oct 26, 2024
1 parent cad014a commit dd9e994
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 10 additions & 1 deletion raw_inference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import argparse
import logging

import torch
import yaml
from peft import LoraConfig
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, pipeline


def load_config(config_file="./configs/inference-config.yaml"):
"""
Load the configuration from a YAML file.
Expand Down Expand Up @@ -109,7 +118,7 @@ def main():
device_map=config["model"]["device_map"],
)

model = PeftModel.from_pretrained(base_model, config["model"]["output_dir"])
model = PeftModel1.from_pretrained(base_model, config["model"]["output_dir"])

Check notice on line 121 in raw_inference.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

raw_inference.py#L121

undefined name 'PeftModel1' (F821)
model = model.merge_and_unload()

# Perform text generation
Expand Down
7 changes: 1 addition & 6 deletions training.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import yaml
from datasets import load_dataset
from peft import LoraConfig
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
TrainingArguments,
)
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TrainingArguments
from trl import SFTTrainer


Expand Down

0 comments on commit dd9e994

Please sign in to comment.