Text Generation
PEFT
Safetensors
English
lora
molly-os
specialist
quantum-software-architect
llama-3.1
domain-adaptation
Instructions to use BoomJules/molly-quantum-software-architect with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use BoomJules/molly-quantum-software-architect with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct") model = PeftModel.from_pretrained(base_model, "BoomJules/molly-quantum-software-architect") - Notebooks
- Google Colab
- Kaggle
docs: specialist card with usage, examples and family index
Browse files
README.md
CHANGED
|
@@ -1,26 +1,143 @@
|
|
| 1 |
---
|
| 2 |
-
base_model: meta-llama/Llama-3.1-8B-Instruct
|
| 3 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
tags:
|
| 5 |
- lora
|
|
|
|
| 6 |
- molly-os
|
| 7 |
- specialist
|
| 8 |
-
-
|
| 9 |
-
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Molly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
- **Role:** Quantum Software Architect
|
| 18 |
-
- **Base model:** `meta-llama/Llama-3.1-8B-Instruct`
|
| 19 |
-
- **Adapter type:** LoRA (PEFT), rank **32**, alpha **64**
|
| 20 |
-
- **Training records:** 177
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
endpoint. Intended for research/demo use alongside the Molly OS whitepaper.
|
| 25 |
|
| 26 |
-
Β© 2026
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
library_name: peft
|
| 3 |
+
base_model: meta-llama/Llama-3.1-8B-Instruct
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
license: cc-by-nc-4.0
|
| 8 |
tags:
|
| 9 |
- lora
|
| 10 |
+
- peft
|
| 11 |
- molly-os
|
| 12 |
- specialist
|
| 13 |
+
- quantum-software-architect
|
| 14 |
+
- llama-3.1
|
| 15 |
+
- domain-adaptation
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# Molly Specialist β Quantum Software Architect
|
| 19 |
+
|
| 20 |
+
Generates correct Qiskit and Cirq circuit code, identifies gate decomposition errors, and explains quantum algorithm trade-offs more accurately than the base model.
|
| 21 |
+
|
| 22 |
+
Part of **[Molly](https://iamolly.ai/?utm_source=huggingface&utm_medium=model_card&utm_campaign=specialists&utm_content=molly-quantum-software-architect)**, an orchestrator that keeps a library of small domain
|
| 23 |
+
specialists over one quantized base and routes each request to the right one, so a
|
| 24 |
+
single machine answers across many fields without loading a separate large model
|
| 25 |
+
for each.
|
| 26 |
+
|
| 27 |
+
## What this specialist handles well
|
| 28 |
+
|
| 29 |
+
- Translates quantum algorithms into optimized Qiskit or Cirq circuit code
|
| 30 |
+
- Identifies errors in quantum gate decompositions and circuit depth optimization
|
| 31 |
+
- Explains quantum error correction scheme trade-offs for specific hardware topologies
|
| 32 |
+
|
| 33 |
+
## Try it with
|
| 34 |
+
|
| 35 |
+
- "How do I implement Shor's algorithm in Qiskit with minimal circuit depth?"
|
| 36 |
+
- "What error correction code works best for a 127-qubit heavy-hex topology?"
|
| 37 |
+
- "Convert this QAOA circuit from Cirq to Qiskit preserving gate fidelity"
|
| 38 |
+
|
| 39 |
+
## Before you run: the base model is gated
|
| 40 |
+
|
| 41 |
+
This adapter needs the base weights, and the base is **access-gated**. Do this **once**:
|
| 42 |
+
|
| 43 |
+
1. Accept the base licence: <https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct>
|
| 44 |
+
2. Create a **read token**: <https://huggingface.co/settings/tokens>
|
| 45 |
+
3. Make the token available:
|
| 46 |
+
- **Google Colab:** Secrets panel (key icon) β *Add new secret* β name `HF_TOKEN`, enable **Notebook access**.
|
| 47 |
+
- **Kaggle:** *Add-ons β Secrets* β add `HF_TOKEN`.
|
| 48 |
+
- **Local:** `huggingface-cli login` or `export HF_TOKEN=...`
|
| 49 |
+
|
| 50 |
+
Skipping this gives `GatedRepoError` / `401 Unauthorized` when the **base** loads. A stored
|
| 51 |
+
Colab secret is **not** applied automatically β authenticate in code, as below.
|
| 52 |
+
|
| 53 |
+
## Quickstart
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
# pip install -U transformers peft accelerate
|
| 57 |
+
import os, torch
|
| 58 |
+
from huggingface_hub import login
|
| 59 |
+
try:
|
| 60 |
+
from google.colab import userdata
|
| 61 |
+
login(userdata.get("HF_TOKEN"))
|
| 62 |
+
except Exception:
|
| 63 |
+
tok = os.environ.get("HF_TOKEN")
|
| 64 |
+
login(tok) if tok else login()
|
| 65 |
+
|
| 66 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 67 |
+
from peft import PeftModel
|
| 68 |
+
|
| 69 |
+
BASE = "meta-llama/Llama-3.1-8B-Instruct"
|
| 70 |
+
ADAPTER = "BoomJules/molly-quantum-software-architect"
|
| 71 |
+
|
| 72 |
+
tok = AutoTokenizer.from_pretrained(BASE)
|
| 73 |
+
base = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
|
| 74 |
+
model = PeftModel.from_pretrained(base, ADAPTER).eval()
|
| 75 |
+
|
| 76 |
+
msgs = [{"role": "user", "content": "Your question here"}]
|
| 77 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 78 |
+
out = model.generate(ids, max_new_tokens=300)
|
| 79 |
+
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Low-VRAM (4-bit) β fits a free Colab/Kaggle GPU (~6β7 GB)
|
| 83 |
+
|
| 84 |
+
```python
|
| 85 |
+
# pip install -U transformers peft accelerate bitsandbytes
|
| 86 |
+
import os, torch
|
| 87 |
+
from huggingface_hub import login
|
| 88 |
+
try:
|
| 89 |
+
from google.colab import userdata
|
| 90 |
+
login(userdata.get("HF_TOKEN"))
|
| 91 |
+
except Exception:
|
| 92 |
+
login(os.environ.get("HF_TOKEN"))
|
| 93 |
+
|
| 94 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 95 |
+
from peft import PeftModel
|
| 96 |
+
|
| 97 |
+
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
|
| 98 |
+
bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True)
|
| 99 |
+
tok = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
| 100 |
+
base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct", quantization_config=bnb, device_map="auto")
|
| 101 |
+
model = PeftModel.from_pretrained(base, "BoomJules/molly-quantum-software-architect").eval()
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## Adapter details
|
| 105 |
+
|
| 106 |
+
| | |
|
| 107 |
+
|---|---|
|
| 108 |
+
| Base model | `meta-llama/Llama-3.1-8B-Instruct` |
|
| 109 |
+
| Method | LoRA (PEFT) |
|
| 110 |
+
| Rank / alpha | 32 / 64 |
|
| 111 |
+
| Domain | Quantum Software Architect |
|
| 112 |
+
|
| 113 |
+
## Troubleshooting
|
| 114 |
+
|
| 115 |
+
- **`GatedRepoError` / `401 Unauthorized`** β base licence not accepted, or `HF_TOKEN` missing,
|
| 116 |
+
or the Colab secret was stored but `login(...)` was never called.
|
| 117 |
+
- **CUDA out of memory** β use the 4-bit snippet on a GPU runtime.
|
| 118 |
+
- **Adapter seems to have no effect** β confirm the base id matches `base_model` above.
|
| 119 |
+
|
| 120 |
+
## Other Molly specialists
|
| 121 |
+
|
| 122 |
+
- [Quantum Communication Systems Engineer](https://huggingface.co/BoomJules/molly-quantum-communication-systems-engineer)
|
| 123 |
+
- [Infectious Disease Physician Antimicrobial Stewardship](https://huggingface.co/BoomJules/molly-infectious-disease-physician-antimicrobial-stewardship)
|
| 124 |
+
- [Health Informatics Medical AI Specialist](https://huggingface.co/BoomJules/molly-health-informatics-medical-ai-specialist)
|
| 125 |
+
- [Clinical Trial Pharmacologist](https://huggingface.co/BoomJules/molly-clinical-trial-pharmacologist)
|
| 126 |
+
- [Immunopharmacologist](https://huggingface.co/BoomJules/molly-immunopharmacologist)
|
| 127 |
+
- [Climate Analytics Manager](https://huggingface.co/BoomJules/molly-climate-analytics-manager)
|
| 128 |
+
- [Language Technology Consultant](https://huggingface.co/BoomJules/molly-language-technology-consultant)
|
| 129 |
+
- [Polymer Chemist](https://huggingface.co/BoomJules/molly-polymer-chemist)
|
| 130 |
+
- [Composite Materials Engineer](https://huggingface.co/BoomJules/molly-composite-materials-engineer)
|
| 131 |
+
- [Computer Science AI](https://huggingface.co/BoomJules/molly-cs-ai)
|
| 132 |
+
- [Computer Science Algorithms](https://huggingface.co/BoomJules/molly-cs-algorithms)
|
| 133 |
+
- [Computer Science Computer Vision](https://huggingface.co/BoomJules/molly-cs-cv)
|
| 134 |
|
| 135 |
+
Running several of these at once, with the routing decided for you, is what
|
| 136 |
+
[Molly](https://iamolly.ai/?utm_source=huggingface&utm_medium=model_card&utm_campaign=specialists&utm_content=molly-quantum-software-architect) does.
|
| 137 |
|
| 138 |
+
## Licence & intended use
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
+
Adapter: **CC BY-NC 4.0** (attribution, non-commercial). Base model: its own licence.
|
| 141 |
+
Intended for research and evaluation in Quantum Software Architect.
|
|
|
|
| 142 |
|
| 143 |
+
Β© 2026 Core Labs R&D.
|