Skip to content

inference #661

Answered by alexflint
yahya-mdarhri asked this question in Q&A
Jul 3, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You can pass a path to a local directory like this:

    adapter_path = "path/to/dir/containing/adapter"   # this dir must contain files adapter_config.json and adapter_model.bin

    # Load the config file
    config = PeftConfig.from_pretrained(adapter_path)

    # Setup the bitsandbytes config
    bnb_config = BitsAndBytesConfig(
        load_in_4bit=True,
        bnb_4bit_use_double_quant=True,
        bnb_4bit_quant_type="nf4",
        bnb_4bit_compute_dtype=torch.bfloat16,
    )

    # Load the base model
    base_model = AutoModelForCausalLM.from_pretrained(
        config.base_model_name_or_path,
        return_dict=True,
        quantization_config=bnb_config,
        device_map="…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yahya-mdarhri
Comment options

Answer selected by BenjaminBossan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants