File size: 6,244 Bytes
139d678
 
47bcc8f
 
 
 
 
139d678
 
47bcc8f
139d678
 
47bcc8f
 
 
139d678
 
47bcc8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139d678
47bcc8f
 
139d678
47bcc8f
139d678
47bcc8f
 
139d678
47bcc8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
library_name: peft
base_model: meta-llama/Llama-3.1-8B-Instruct
pipeline_tag: text-generation
language:
- en
license: cc-by-nc-4.0
tags:
- lora
- peft
- molly-os
- specialist
- composite-materials-engineer
- llama-3.1
- domain-adaptation
---

# Molly Specialist — Composite Materials Engineer

This adapter improves accuracy in predicting laminate stiffness matrices, identifying fiber-matrix failure modes, and selecting resin systems for specific load and temperature conditions.

Part of **[Molly](https://iamolly.ai/?utm_source=huggingface&utm_medium=model_card&utm_campaign=specialists&utm_content=molly-composite-materials-engineer)**, an orchestrator that keeps a library of small domain
specialists over one quantized base and routes each request to the right one, so a
single machine answers across many fields without loading a separate large model
for each.

## What this specialist handles well

- Calculate laminate stiffness and compliance matrices using classical lamination theory
- Identify delamination, fiber breakage, and matrix cracking failure modes from stress data
- Select fiber-matrix-resin systems for target mechanical properties and environmental conditions

## Try it with

- "What layup sequence minimizes thermal residual stresses in a carbon-epoxy laminate?"
- "How do I predict the shear modulus of a unidirectional glass-fiber composite?"
- "Which resin system should I use for a composite part exposed to 200°C?"

## Before you run: the base model is gated

This adapter needs the base weights, and the base is **access-gated**. Do this **once**:

1. Accept the base licence: <https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct>
2. Create a **read token**: <https://huggingface.co/settings/tokens>
3. Make the token available:
   - **Google Colab:** Secrets panel (key icon) → *Add new secret* → name `HF_TOKEN`, enable **Notebook access**.
   - **Kaggle:** *Add-ons → Secrets* → add `HF_TOKEN`.
   - **Local:** `huggingface-cli login` or `export HF_TOKEN=...`

Skipping this gives `GatedRepoError` / `401 Unauthorized` when the **base** loads. A stored
Colab secret is **not** applied automatically — authenticate in code, as below.

## Quickstart

```python
# pip install -U transformers peft accelerate
import os, torch
from huggingface_hub import login
try:
    from google.colab import userdata
    login(userdata.get("HF_TOKEN"))
except Exception:
    tok = os.environ.get("HF_TOKEN")
    login(tok) if tok else login()

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

BASE = "meta-llama/Llama-3.1-8B-Instruct"
ADAPTER = "BoomJules/molly-composite-materials-engineer"

tok = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, ADAPTER).eval()

msgs = [{"role": "user", "content": "Your question here"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=300)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
```

## Low-VRAM (4-bit) — fits a free Colab/Kaggle GPU (~6–7 GB)

```python
# pip install -U transformers peft accelerate bitsandbytes
import os, torch
from huggingface_hub import login
try:
    from google.colab import userdata
    login(userdata.get("HF_TOKEN"))
except Exception:
    login(os.environ.get("HF_TOKEN"))

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel

bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
                         bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True)
tok = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct", quantization_config=bnb, device_map="auto")
model = PeftModel.from_pretrained(base, "BoomJules/molly-composite-materials-engineer").eval()
```

## Adapter details

| | |
|---|---|
| Base model | `meta-llama/Llama-3.1-8B-Instruct` |
| Method | LoRA (PEFT) |
| Rank / alpha | 32 / 64 |
| Domain | Composite Materials Engineer |

## Troubleshooting

- **`GatedRepoError` / `401 Unauthorized`** — base licence not accepted, or `HF_TOKEN` missing,
  or the Colab secret was stored but `login(...)` was never called.
- **CUDA out of memory** — use the 4-bit snippet on a GPU runtime.
- **Adapter seems to have no effect** — confirm the base id matches `base_model` above.

## Other Molly specialists

- [Quantum Software Architect](https://huggingface.co/BoomJules/molly-quantum-software-architect)
- [Quantum Communication Systems Engineer](https://huggingface.co/BoomJules/molly-quantum-communication-systems-engineer)
- [Infectious Disease Physician Antimicrobial Stewardship](https://huggingface.co/BoomJules/molly-infectious-disease-physician-antimicrobial-stewardship)
- [Health Informatics Medical AI Specialist](https://huggingface.co/BoomJules/molly-health-informatics-medical-ai-specialist)
- [Clinical Trial Pharmacologist](https://huggingface.co/BoomJules/molly-clinical-trial-pharmacologist)
- [Immunopharmacologist](https://huggingface.co/BoomJules/molly-immunopharmacologist)
- [Climate Analytics Manager](https://huggingface.co/BoomJules/molly-climate-analytics-manager)
- [Language Technology Consultant](https://huggingface.co/BoomJules/molly-language-technology-consultant)
- [Polymer Chemist](https://huggingface.co/BoomJules/molly-polymer-chemist)
- [Computer Science AI](https://huggingface.co/BoomJules/molly-cs-ai)
- [Computer Science Algorithms](https://huggingface.co/BoomJules/molly-cs-algorithms)
- [Computer Science Computer Vision](https://huggingface.co/BoomJules/molly-cs-cv)

Running several of these at once, with the routing decided for you, is what
[Molly](https://iamolly.ai/?utm_source=huggingface&utm_medium=model_card&utm_campaign=specialists&utm_content=molly-composite-materials-engineer) does.

## Licence & intended use

Adapter: **CC BY-NC 4.0** (attribution, non-commercial). Base model: its own licence.
Intended for research and evaluation in Composite Materials Engineer.

© 2026 Core Labs R&D.