File size: 3,082 Bytes
acaa7ce
1a1bad0
 
 
 
 
 
 
5e30a24
1a1bad0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
base_model: Qwen/Qwen3.8-27B
tags:
  - qwen
  - finetune
  - engineering
  - code-generation
language:
  - en
---

# engineering_model

Fine-tuned **Qwen3.8-27B** for engineering tasks: code generation, debugging, architecture design, and technical Q&A.

## Base model
[Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)

## Datasets used
- `open-vdb/glove-100-angular`
- `open-vdb/nytimes-16-angular`
- `open-vdb/nytimes-256-angular`
- `rsh-raj/angular-cli-commits`
- `rsh-raj/angular-commits`
- `lone17/angular-steering-artifacts`

## Usage

### With transformers (full model)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "anmolthukral/engineering_model"

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
)

prompt = "### User:\nWrite a Python function to detect cycles in a directed graph.\n### Assistant:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        temperature=0.7,
        top_p=0.9,
        do_sample=True,
        repetition_penalty=1.1
    )

print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### With 4-bit quantization (recommended for 27B)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_use_double_quant=True
)

model = AutoModelForCausalLM.from_pretrained(
    "anmolthukral/engineering_model",
    quantization_config=bnb_config,
    device_map="auto",
    trust_remote_code=True
)
```

### Chat template (Qwen format)
```python
messages = [
    {"role": "user", "content": "Explain the difference between mutex and semaphore"},
    {"role": "assistant", "content": "..."},
    {"role": "user", "content": "Show me a C++ example"}
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# ... generate
```

## Hardware requirements

| Precision | VRAM (single GPU) | Notes |
|-----------|-------------------|-------|
| bfloat16 | ~54 GB | 2×A100 80GB or 4×A10G |
| 4-bit (NF4) | ~16 GB | 1×A10G / A100 40GB |
| 8-bit | ~28 GB | 1×A100 40GB |

## Limitations
- Trained on Angular/engineering data — may be biased toward frontend/web patterns
- 27B parameters requires significant compute for inference
- Not evaluated on safety benchmarks — use with caution in production

## Citation
```bibtex
@misc{engineering_model,
  author = {Anmol Thukral},
  title = {engineering_model: Qwen3.8-27B fine-tuned for engineering tasks},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/anmolthukral/engineering_model}}
}
```