Instructions to use DongkiKim/Mol-Llama-3.1-8B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DongkiKim/Mol-Llama-3.1-8B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DongkiKim/Mol-Llama-3.1-8B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import MolLLaMA model = MolLLaMA.from_pretrained("DongkiKim/Mol-Llama-3.1-8B-Instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DongkiKim/Mol-Llama-3.1-8B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DongkiKim/Mol-Llama-3.1-8B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DongkiKim/Mol-Llama-3.1-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/DongkiKim/Mol-Llama-3.1-8B-Instruct
- SGLang
How to use DongkiKim/Mol-Llama-3.1-8B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "DongkiKim/Mol-Llama-3.1-8B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DongkiKim/Mol-Llama-3.1-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "DongkiKim/Mol-Llama-3.1-8B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DongkiKim/Mol-Llama-3.1-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use DongkiKim/Mol-Llama-3.1-8B-Instruct with Docker Model Runner:
docker model run hf.co/DongkiKim/Mol-Llama-3.1-8B-Instruct
ValueError: The checkpoint you are trying to load has model type `mol_llama` but Transformers does not recognize this architecture.
#2
by Codemaster67 - opened
So i tried using the model via the offical collab notebook provided https://colab.research.google.com/#fileId=https%3A//huggingface.co/DongkiKim/Mol-Llama-3.1-8B-Instruct.ipynb
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.12/dist-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1430 try:
-> 1431 config_class = CONFIG_MAPPING[config_dict["model_type"]]
1432 except KeyError:
3 frames
KeyError: 'mol_llama'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
/usr/local/lib/python3.12/dist-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1431 config_class = CONFIG_MAPPING[config_dict["model_type"]]
1432 except KeyError:
-> 1433 raise ValueError(
1434 f"The checkpoint you are trying to load has model type `{config_dict['model_type']}` "
1435 "but Transformers does not recognize this architecture. This could be because of an "
ValueError: The checkpoint you are trying to load has model type `mol_llama` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.
You can update Transformers with the command `pip install --upgrade transformers`. If this does not work, and the checkpoint is very new, then there may not be a release version that supports this model yet. In this case, you can get the most up-to-date code by installing Transformers from source with the command `pip install git+https://github.com/huggingface/transformers.git`
i tried upgrade the transformers to 5.2.0 (via running !pip install --upgrade transformers) and i got the same error
for the third cell i got this error
ImportError Traceback (most recent call last)
/tmp/ipython-input-2461261565.py in <cell line: 0>()
1 # Load model directly
----> 2 from transformers import MolLlaMA
3 model = MolLLaMA.from_pretrained("DongkiKim/Mol-Llama-3.1-8B-Instruct", dtype="auto")
ImportError: cannot import name 'MolLlaMA' from 'transformers' (/usr/local/lib/python3.12/dist-packages/transformers/__init__.py)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.