Instructions to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04") model = AutoModelForMultimodalLM.from_pretrained("kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04
- SGLang
How to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 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 "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04" \ --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": "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04", "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 "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04" \ --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": "kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04", max_seq_length=2048, ) - Docker Model Runner
How to use kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04 with Docker Model Runner:
docker model run hf.co/kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04
Uploaded model
- Developed by: kevinkawchak
- License: llama3
- Finetuned from model : unsloth/llama-3-8b-Instruct-bnb-4bit
- Finetuned using dataset : zjunlp/Mol-Instructions, cc-by-4.0
- Dataset identification: Molecule-oriented Instructions
- Dataset function: Description guided molecule design
The following are modifications or improvements to original notebooks. Please refer to the authors' models for the published primary work.
Cover Image. META LLAMA 3 COMMUNITY LICENSE AGREEMENT. Built with Meta Llama 3.
A 4-bit quantization of Meta-Llama-3-8B-Instruct was used to reduce training memory requirements when fine-tuning on the zjunlp/Mol-Instructions dataset. (1-2) In addition, the minimum LoRA rank value was utilized to reduce the overall size of created models. In specific, the molecule-oriented instructions description guided molecule design was implemented to answer general questions and general biochemistry questions. General questions were answered with high accuracy, while biochemistry related questions returned 'SELFIES' structures but with limited accuracy.
The notebook featured Torch and Hugging Face libraries using the Unsloth llama-3-8b-Instruct-bnb-4bit quantization model. Training loss decreased steadily from 1.97 to 0.73 over 60 steps. Additional testing regarding the appropriate level of compression or hyperparameter adjustments for accurate SELFIES chemical structures outputs is relevant, as shown in the GitHub notebook for research purposes (3). A 16-bit and reduced 4-bit size were uploaded to Hugging Face. (4-5)
Update 04/24: The number of training steps were increased to further decrease loss, while maintaining reduced memory requirements through quantization and reduced size through LoRA. This allowed for significantly improved responses to biochemistry related questions, and were saved at the following LLM Model sizes: 8.03B, 4.65B. github.
References:
- unsloth: https://huggingface.co/unsloth/llama-3-8b-Instruct-bnb-4bit
- zjunlp: https://huggingface.co/datasets/zjunlp/Mol-Instructions
- github: https://github.com/kevinkawchak/Medical-Quantum-Machine-Learning/blob/main/Code/Drug%20Discovery/Meta-Llama-3/Meta-Llama-3-8B-Instruct-Mol.ipynb
- hugging face: https://huggingface.co/kevinkawchak/Meta-Llama-3-8B-Instruct-LoRA-Mol16
- hugging face: https://huggingface.co/kevinkawchak/Meta-Llama-3-8B-Instruct-LoRA-Mol04
@inproceedings{fang2023mol,
author = {Yin Fang and
Xiaozhuan Liang and
Ningyu Zhang and
Kangwei Liu and
Rui Huang and
Zhuo Chen and
Xiaohui Fan and
Huajun Chen},
title = {Mol-Instructions: {A} Large-Scale Biomolecular Instruction Dataset
for Large Language Models},
booktitle = {{ICLR}},
publisher = {OpenReview.net},
year = {2024},
url = {https://openreview.net/pdf?id=Tlsdsb6l9n}}
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
- Downloads last month
- 5
Model tree for kevinkawchak/Meta-Llama-3-8B-Instruct-Molecule04
Base model
unsloth/llama-3-8b-Instruct-bnb-4bit