Skip to content

[Fixed] TypeError: 'bool' object is not callable #77

Closed

Description

@dame-cell

so recently found out about unsloth and i was trying one of the tutorials provided when trying to load the model i got and error
This is the code

from unsloth import FastLanguageModel
import torch
max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "unsloth/llama-2-7b", # "unsloth/mistral-7b" for 16bit loading
    max_seq_length = max_seq_length,
    dtype = dtype,
    load_in_4bit = load_in_4bit,)
TypeError                                 Traceback (most recent call last)
<ipython-input-1-7adc0e5cc71e> in <cell line: 7>()
      5 load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
      6 
----> 7 model, tokenizer = FastLanguageModel.from_pretrained(
      8     model_name = "unsloth/llama-2-7b", # "unsloth/mistral-7b" for 16bit loading
      9     max_seq_length = max_seq_length,

1 frames
/usr/local/lib/python3.10/dist-packages/unsloth/models/llama.py in from_pretrained(model_name, max_seq_length, dtype, load_in_4bit, token, device_map, rope_scaling, check_tokenizer)
    706         # We check the tokenizer first for errors
    707         if check_tokenizer:
--> 708             tokenizer = check_tokenizer(
    709                 model = model,
    710                 tokenizer = tokenizer,

TypeError: 'bool' object is not callable

Activity

  1. dame-cell commented on Jan 9, 2024

    @dame-cell
    ContributorAuthor
    from unsloth import FastLanguageModel
    import torch
    max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
    dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
    load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
    
    
    model, tokenizer = FastLanguageModel.from_pretrained(
        model_name = "unsloth/llama-2-7b", # "unsloth/mistral-7b" for 16bit loading
        max_seq_length = max_seq_length,
        dtype = dtype,
        load_in_4bit = load_in_4bit,
        token="hf_XXXXXX",
        check_tokenizer=False
    )

    it seems that when I put false for check_tokenizer it works but reading the code for the FastLanguageModel.pretrained i can tell that the check_tokenizer seems important so any help would be great on this

  2. RonanKMcGovern commented on Jan 9, 2024

    @RonanKMcGovern

    Yes, same issue here.

  3. danielhanchen commented on Jan 9, 2024

    @danielhanchen
    Member

    OOPS my big apologies fixed immediately just now - it should work now @RonanKMcGovern @dame-cell

    Thanks so much @dame-cell for the quick issue!

  4. danielhanchen commented on Jan 9, 2024

    @danielhanchen
    Member

    For Colab - close the entire notebook and reopen it OR go to "Runtime", click "Disconnect and Delete Runtime", then click "Run All"

  5. changed the title [-]cannot load model from FastLanguageModel.from_pretrained [/-] [+][Fixed] cannot load model from FastLanguageModel.from_pretrained [/+] on Jan 9, 2024
  6. changed the title [-][Fixed] cannot load model from FastLanguageModel.from_pretrained [/-] [+][Fixed] TypeError: 'bool' object is not callable[/+] on Jan 9, 2024
  7. pinned this issue on Jan 9, 2024
  8. dame-cell commented on Jan 9, 2024

    @dame-cell
    ContributorAuthor

    yea it works now thanks

  9. unpinned this issue on Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions