Text Generation
Transformers
Safetensors
English
qwen3_5
chemistry
covalent-organic-frameworks
reactive-oxygen-species
redox
qlora
sft
scientific-qa
conversational
Instructions to use Willlzh/COFOS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Willlzh/COFOS with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Willlzh/COFOS") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("Willlzh/COFOS") model = AutoModelForCausalLM.from_pretrained("Willlzh/COFOS") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Willlzh/COFOS with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Willlzh/COFOS" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Willlzh/COFOS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Willlzh/COFOS
- SGLang
How to use Willlzh/COFOS 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 "Willlzh/COFOS" \ --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": "Willlzh/COFOS", "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 "Willlzh/COFOS" \ --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": "Willlzh/COFOS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Willlzh/COFOS with Docker Model Runner:
docker model run hf.co/Willlzh/COFOS
| license: mit | |
| language: | |
| - en | |
| pipeline_tag: text-generation | |
| tags: | |
| - chemistry | |
| - covalent-organic-frameworks | |
| - reactive-oxygen-species | |
| - redox | |
| - qlora | |
| - sft | |
| - scientific-qa | |
| datasets: | |
| - Willlzh/COFOS_data | |
| library_name: transformers | |
| # COFOS | |
| COFOS is a domain-adapted language model for question answering about covalent | |
| organic frameworks (COFs), reactive oxygen species (ROS), oxygen-derived | |
| products, and photocatalytic or redox reaction mechanisms. | |
| The model is intended to answer chemistry questions in a natural QA style while | |
| preserving important distinctions such as: | |
| - dominant ROS or oxygen-derived products versus secondary ROS or intermediates | |
| - H2O2 as an oxygen-derived product rather than a radical ROS | |
| - condition-dependent behavior under light, oxygen, water, sacrificial reagents, | |
| PMS, or related reaction environments | |
| - uncertainty when the available information is insufficient | |
| ## Model Details | |
| - **Model name:** COFOS | |
| - **Repository:** `Willlzh/COFOS` | |
| - **Model type:** causal language model | |
| - **Architecture family:** Qwen-style decoder-only language model | |
| - **Training method:** QLoRA SFT followed by adapter merge | |
| - **Training data:** [`Willlzh/COFOS_data`](https://huggingface.co/datasets/Willlzh/COFOS_data) | |
| - **Primary language:** English | |
| - **License:** MIT | |
| The uploaded checkpoint is a merged Transformers model directory. It can be | |
| loaded directly with `AutoModelForCausalLM.from_pretrained()` without separately | |
| loading a LoRA adapter. | |
| ## Intended Use | |
| COFOS is designed for research-oriented QA and drafting assistance around: | |
| - COF photocatalysis | |
| - ROS generation and assignment | |
| - oxygen reduction and H2O2 photoproduction | |
| - PMS-assisted oxidation mechanisms | |
| - evidence-aware explanations of dominant versus secondary species | |
| - chemistry and redox QA in an educational or literature-review setting | |
| It is not a substitute for experimental validation, safety review, or expert | |
| chemical judgment. | |
| ## Usage | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| model_id = "Willlzh/COFOS" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| torch_dtype=torch.bfloat16, | |
| device_map="auto", | |
| trust_remote_code=True, | |
| ) | |
| question = "What ROS does TT-T-COF generate under visible-light photocatalysis?" | |
| messages = [ | |
| { | |
| "role": "system", | |
| "content": ( | |
| "You are COFOS, a natural QA assistant for covalent organic " | |
| "frameworks and reactive oxygen species. Answer directly and do " | |
| "not call H2O2 a radical ROS." | |
| ), | |
| }, | |
| {"role": "user", "content": question}, | |
| ] | |
| prompt = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=False, | |
| add_generation_prompt=True, | |
| ) | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| with torch.no_grad(): | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=256, | |
| do_sample=False, | |
| ) | |
| print(tokenizer.decode(outputs[0], skip_special_tokens=True)) | |
| ``` | |
| ## Example Questions | |
| ```text | |
| What ROS does TT-T-COF generate under visible-light photocatalysis? | |
| ``` | |
| ```text | |
| In a Fe3O4@TpMa/PMS photocatalytic system, which ROS are dominant for phenol degradation? | |
| ``` | |
| ```text | |
| Why should H2O2 not be described as a radical ROS? | |
| ``` | |
| ```text | |
| What should be considered before assigning O2·- or ·OH as the dominant ROS? | |
| ``` | |
| ## Training Data | |
| The model was trained with a mixture of COFOS-specific and chemistry-oriented | |
| SFT data: | |
| - `cofos_teacher_distill.jsonl`: teacher-distilled COF/ROS QA data | |
| - `cofos_rag_sft.jsonl`: RAG-style samples with question, KG facts, retrieved | |
| evidence, and answer | |
| - `chem_redox_sft.jsonl`: English chemistry/redox QA samples | |
| - `style_correction_sft.jsonl`: answer-style correction samples focused on | |
| natural QA behavior and avoiding awkward evidence boilerplate | |
| The dataset is available at | |
| [`Willlzh/COFOS_data`](https://huggingface.co/datasets/Willlzh/COFOS_data). | |
| ## Limitations | |
| - The model may still hallucinate details for materials or conditions that are | |
| not represented in its training data. | |
| - The model is not guaranteed to cite sources correctly unless used with an | |
| external retrieval system. | |
| - Mechanistic explanations should be treated as research assistance rather than | |
| final experimental conclusions. | |
| - The model should not be used for high-stakes chemical safety, medical, legal, | |
| or regulatory decisions. | |
| ## Recommended Deployment Pattern | |
| For the best COFOS experience, use the model as part of a local persistent | |
| assistant or a retrieval-augmented workflow: | |
| ```text | |
| user question | |
| -> optional KG/BM25 retrieval | |
| -> COFOS model | |
| -> natural QA answer | |
| ``` | |
| The merged model can also be used directly for lightweight QA without retrieval, | |
| but RAG is recommended for record-specific material questions. | |
| ## Citation | |
| If you use COFOS in a project, please cite or link this model repository and the | |
| associated dataset: | |
| - Model: `Willlzh/COFOS` | |
| - Dataset: `Willlzh/COFOS_data` | |