Instructions to use aksw/Bike-bioactivity with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aksw/Bike-bioactivity with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("aksw/Bike-bioactivity", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use aksw/Bike-bioactivity 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 aksw/Bike-bioactivity 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 aksw/Bike-bioactivity to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for aksw/Bike-bioactivity to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="aksw/Bike-bioactivity", max_seq_length=2048, )
| base_model: unsloth/phi-4-unsloth-bnb-4bit | |
| tags: | |
| - text-generation-inference | |
| - transformers | |
| - unsloth | |
| - llama | |
| - trl | |
| license: apache-2.0 | |
| language: | |
| - en | |
| # Uploaded model | |
| - **Developed by:** aksw | |
| - **License:** apache-2.0 | |
| - **Finetuned from model :** unsloth/phi-4-unsloth-bnb-4bit | |
| This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library. | |
| [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth) | |
| ## 📄 Model Card: `aksw/Bike-bioactivity` | |
| ### 🧠 Model Overview | |
| `Bike-bioactivity` is a Medium fine-tuned language model designed to **extract biochemical biological activities from scientific text articles**. It is ideal for Information Retrieval systems based on Biohemical Knowledge Extraction. | |
| --- | |
| ### 🚨 Disclaimer | |
| This model cannot be used to compare with other methods in the Bike challenge or in scientific articles from the NatUKE Benchmark because it was trained with all the benchmark data. This means that this method used some of the NatUKE test data in its fine-tuning. It is intended for exploration in other benchmarks or for future Bike challenges where the test sets will not come from the NatUKE test sets. | |
| --- | |
| ### 🔍 Intended Use | |
| * **Input**: Text from a Biochemical PDF file | |
| * **Output**: A **single list** containing the corresponding biochemical biological activities from the text. | |
| --- | |
| ### 🧩 Applications | |
| * Question Answering systems over Biochemical Datasets | |
| * Biochemical Knowledge graph exploration tools | |
| * Extraction of biochemical biological activities from scientific text articles | |
| --- | |
| ### ⚙️ Model Details | |
| * **Base model**: Phi 4 14B (via Unsloth) | |
| * **Training**: Scientific text articles | |
| * 33 unique Biological Activities | |
| * 143 articles | |
| * **Target Ontology**: NatUke Benchmarking (https://github.com/AKSW/natuke) | |
| * **Frameworks**: Unsloth, HuggingFace, Transformers | |
| --- | |
| ### 📦 Installation | |
| Make sure to install `unsloth`, `torch` and CUDA dependencies: | |
| ```bash | |
| pip install unsloth torch | |
| ``` | |
| --- | |
| ### 🧪 Example: Inference Code | |
| ```python | |
| from unsloth import FastLanguageModel | |
| import torch | |
| class BiKEBioactivityExtractor: | |
| def __init__(self, model_name: str, max_seq_length: int = 32768, load_in_4bit: bool = True): | |
| self.model, self.tokenizer = FastLanguageModel.from_pretrained( | |
| model_name=model_name, | |
| max_seq_length=max_seq_length, | |
| load_in_4bit=load_in_4bit | |
| ) | |
| _ = FastLanguageModel.for_inference(self.model) | |
| def build_prompt(self, article_text: str) -> list: | |
| return [ | |
| {"role": "system", "content": ( | |
| "You are a scientist trained in chemistry.\n" | |
| "You must extract information from scientific papers identifying relevant properties associated with each natural product discussed in the academic publication.\n" | |
| "For each paper, you have to analyze the content (text) to identify the *Biological Activity*. It can be more than one biological activity.\n" | |
| "Your output should be a list with the biological activities. Return only the list, without any additional information.\n" | |
| )}, | |
| {"role": "user", "content": article_text} | |
| ] | |
| def extract_bioactivity(self, article_text: str, temperature: float = 0.01, max_new_tokens: int = 1024) -> str: | |
| si = "<|im_start|>assistant<|im_sep|>" | |
| sf = "<|im_end|>" | |
| messages = self.build_prompt(article_text) | |
| inputs = self.tokenizer.apply_chat_template( | |
| messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" | |
| ).to("cuda") | |
| outputs = self.model.generate(inputs, max_new_tokens=max_new_tokens, use_cache=True, temperature=temperature, min_p=0.1) | |
| decoded = self.tokenizer.batch_decode(outputs)[0] | |
| parsed = decoded[decoded.find(si):].replace(si, "").replace(sf, "") | |
| try: | |
| l = eval(parsed) | |
| except: | |
| l = parsed | |
| print('Your output is not a list, you will need one more preprocessing step.') | |
| return l | |
| # --- Using the model --- | |
| if __name__ == "__main__": | |
| extractor = BiKEBioactivityExtractor(model_name="aksw/Bike-bioactivity") | |
| text = "Title, Abstract, Introduction, Background, Method, Results, Conclusion, References." | |
| list_bio = extractor.extract_bioactivity(text) | |
| print(list_bio) | |
| ``` | |
| --- | |
| ### 🧪 Evaluation | |
| The model was evaluated using Hits@k on the test sets of the NatUKE Benchmark (do Carmo et al. 2023) | |
| --- | |
| Do Carmo, Paulo Viviurka, et al. "NatUKE: A Benchmark for Natural Product Knowledge Extraction from Academic Literature." 2023 IEEE 17th International Conference on Semantic Computing (ICSC). IEEE, 2023. | |
| ### 📚 Citation | |
| If you use this model in your work, please cite it as: | |
| ``` | |
| @inproceedings{ref:doCarmo2025, | |
| title={Improving Natural Product Knowledge Extraction from Academic Literature with Enhanced PDF Text Extraction and Large Language Models}, | |
| author={Viviurka do Carmo, Paulo and Silva G{\^o}lo, Marcos Paulo and Gwozdz, Jonas and Marx, Edgard and Marcondes Marcacini, Ricardo}, | |
| booktitle={Proceedings of the 40th ACM/SIGAPP Symposium on Applied Computing}, | |
| pages={980--987}, | |
| year={2025} | |
| } | |
| ``` | |