Reputation: 330
I'm trying to run a LM locally I don't really have much knowledge of huggingface.
What I did is creating account there then creating a token that can read/write.
I created a project did pip install transformers tensorflow
After that I created a fily test.py:
from transformers import pipeline
HF_TOKEN ='MY_TOKEN_VALUE_HERE'
hugging_face_model = 'mistralai/Mistral-Small-24B-Instruct-2501'
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe = pipeline(
"text-generation",
model=hugging_face_model,
token=HF_TOKEN,
max_length=200
)
pipe(messages)
And I get this error:
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
cli.main()
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
run()
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
_run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
File "/home/louis/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
exec(code, run_globals)
File "/home/louis/zero-to-million/backend/test.py", line 13, in <module>
pipe = pipeline(
File "/home/louis/zero-to-million/backend/venv/lib/python3.10/site-packages/transformers/pipelines/__init__.py", line 940, in pipeline
framework, model = infer_framework_load_model(
File "/home/louis/zero-to-million/backend/venv/lib/python3.10/site-packages/transformers/pipelines/base.py", line 290, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "/home/louis/zero-to-million/backend/venv/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 564, in from_pretrained
return model_class.from_pretrained(
File "/home/louis/zero-to-million/backend/venv/lib/python3.10/site-packages/transformers/modeling_tf_utils.py", line 2909, in from_pretrained
resolved_archive_file, sharded_metadata = get_checkpoint_shard_files(
File "/home/louis/zero-to-million/backend/venv/lib/python3.10/site-packages/transformers/utils/hub.py", line 1010, in get_checkpoint_shard_files
if not os.path.isfile(index_filename):
File "/usr/lib/python3.10/genericpath.py", line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
I understand the error but I am not sure what path it's referring to?
Upvotes: 1
Views: 43