microsoft / microsoft/BitNet

OSError: microsoft/bitnet-b1.58-2B-4T does not appear to have a file named configuration_bitnet.py.

Open
#245 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
40.3k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "microsoft/bitnet-b1.58-2B-4T"

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True
)

error:

[/usr/local/lib/python3.11/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in cached_files(path_or_repo_id, filenames, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)
    515             f"a file named {missing_entries[0]}" if len(missing_entries) == 1 else f"files named {(*missing_entries,)}"
    516         )
--> 517         raise EnvironmentError(
    518             f"{path_or_repo_id} does not appear to have {msg}. Checkout '[https://huggingface.co/{path_or_repo_id}/tree/{revision_}'](https://huggingface.co/%7Bpath_or_repo_id%7D/tree/%7Brevision_%7D')"
    519             "for available files."

OSError: microsoft/bitnet-b1.58-2B-4T does not appear to have a file named configuration_bitnet.py. Checkout 'https://huggingface.co/microsoft/bitnet-b1.58-2B-4T/tree/main'for available files.

full error message:

tokenizer_config.json: 100%
 50.8k/50.8k [00:00<00:00, 3.24MB/s]
tokenizer.json: 100%
 9.09M/9.09M [00:01<00:00, 6.95MB/s]
special_tokens_map.json: 100%
 73.0/73.0 [00:00<00:00, 6.26kB/s]
config.json: 100%
 844/844 [00:00<00:00, 60.5kB/s]
Could not locate the configuration_bitnet.py inside microsoft/bitnet-b1.58-2B-4T.
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
[<ipython-input-1-1be1fd968872>](https://localhost:8080/#) in <cell line: 0>()
      6 # Load tokenizer and model
      7 tokenizer = AutoTokenizer.from_pretrained(model_id)
----> 8 model = AutoModelForCausalLM.from_pretrained(
      9     model_id,
     10     torch_dtype=torch.bfloat16,

5 frames
[/usr/local/lib/python3.11/dist-packages/transformers/models/auto/auto_factory.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    529                 _ = kwargs.pop("quantization_config")
    530 
--> 531             config, kwargs = AutoConfig.from_pretrained(
    532                 pretrained_model_name_or_path,
    533                 return_unused_kwargs=True,

[/usr/local/lib/python3.11/dist-packages/transformers/models/auto/configuration_auto.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
   1121         if has_remote_code and trust_remote_code:
   1122             class_ref = config_dict["auto_map"]["AutoConfig"]
-> 1123             config_class = get_class_from_dynamic_module(
   1124                 class_ref, pretrained_model_name_or_path, code_revision=code_revision, **kwargs
   1125             )

[/usr/local/lib/python3.11/dist-packages/transformers/dynamic_module_utils.py](https://localhost:8080/#) in get_class_from_dynamic_module(class_reference, pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)
    556         code_revision = revision
    557     # And lastly we get the class inside our newly created module
--> 558     final_module = get_cached_module_file(
    559         repo_id,
    560         module_file + ".py",

[/usr/local/lib/python3.11/dist-packages/transformers/dynamic_module_utils.py](https://localhost:8080/#) in get_cached_module_file(pretrained_model_name_or_path, module_file, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, repo_type, _commit_hash, **deprecated_kwargs)
    360     try:
    361         # Load from URL or cache if already cached
--> 362         resolved_module_file = cached_file(
    363             pretrained_model_name_or_path,
    364             module_file,

[/usr/local/lib/python3.11/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in cached_file(path_or_repo_id, filename, **kwargs)
    264     ```
    265     """
--> 266     file = cached_files(path_or_repo_id=path_or_repo_id, filenames=[filename], **kwargs)
    267     file = file[0] if file is not None else file
    268     return file

[/usr/local/lib/python3.11/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in cached_files(path_or_repo_id, filenames, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)
    515             f"a file named {missing_entries[0]}" if len(missing_entries) == 1 else f"files named {(*missing_entries,)}"
    516         )
--> 517         raise EnvironmentError(
    518             f"{path_or_repo_id} does not appear to have {msg}. Checkout '[https://huggingface.co/{path_or_repo_id}/tree/{revision_}'](https://huggingface.co/%7Bpath_or_repo_id%7D/tree/%7Brevision_%7D')"
    519             "for available files."

OSError: microsoft/bitnet-b1.58-2B-4T does not appear to have a file named configuration_bitnet.py. Checkout 'https://huggingface.co/microsoft/bitnet-b1.58-2B-4T/tree/main'for available files.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown AutoTokenizer and AutoModelForCausalLM.from_pretrained entry points, then compare the downloaded config.json with the referenced microsoft/bitnet-b1.58-2B-4T model files. Done means the example loads the tokenizer and model without the missing configuration_bitnet.py error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.