File size: 4,291 Bytes
b20b2ef fc73351 b20b2ef fc73351 b20b2ef | 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 | ---
tags:
- computer-networking
- networking
- llama-3
- llama-3.1
- networking-protocols
- network-security
- tcp-ip
- ospf
- bgp
- research
license: llama3.1
base_model:
- meta-llama/Llama-3.1-8B-Instruct
---
# Llama-3.1-8B-Computer-Networks-LLM
[](https://github.com/IrfanUruchi/Llama-3.1-8B-Computer-Networks-LLM)
[](https://huggingface.co/Irfanuruchi/Llama-3.1-8B-Computer-Networks-LLM)
[](https://github.com/meta-llama/llama3/blob/main/LICENSE)
---
## 🔍 Model Description
**Fine-tuned from**: [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct)
**Domain specialization**: Computer networking with enhanced capabilities in:
- Network protocol explanations (OSPF, BGP, TCP/IP stack)
- Configuration template generation
- Troubleshooting scenarios
- Security best practices
- RFC interpretation
---
## Installation & Usage
### Using Hugging Face Directly (Recommended)
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
from transformers import BitsAndBytesConfig
quant_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16
)
model = AutoModelForCausalLM.from_pretrained(
"Irfanuruchi/Llama-3.1-8B-Computer-Networks-LLM",
quantization_config=quant_config,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("Irfanuruchi/Llama-3.1-8B-Computer-Networks-LLM")
prompt = """You are a network engineering expert. Answer concisely:
Q: What's the difference between TCP and UDP protocols?
A:"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=150)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### Local installation (GitHub):
```bash
git clone https://github.com/IrfanUruchi/Llama-3.1-8B-Computer-Networks-LLM.git
cd Llama-3.1-8B-Computer-Networks-LLM
```
The large safetensor model shards are not stored in the Github repository. Instead i have hosted them in MEGA , there are 6 files totalling around 11GB :
- [model-00001-of-00006.safetensors:](https://mega.nz/file/rppWmDpS#X5utsf27-npdkFQVCQzz_gFi-s5a4oCuUSUYtJDw6p4)
- [model-00002-of-00006.safetensors:](https://mega.nz/file/jkRDVapZ#QhG5Pl8mu-DORIqCvaOfEcHspcVV79Xu-nxiaSa8pmA)
- [model-00003-of-00006.safetensors:](https://mega.nz/file/fsQBjQ6D#MI9gi1L9BDycxGh8qE9D92Q1IiJIMkujFwGeel60rk0)
- [model-00004-of-00006.safetensors:](https://mega.nz/file/7lB3GQZT#va8qP_X-ADHwtmgyxNcGhRklZ6TKFMg9JuNT7Xbl0js)
- [model-00005-of-00006.safetensors:](https://mega.nz/file/n0oS2IoQ#toljZ9fC2pG1r7WTHO_rHhBYC1qv2lGI6Jg_UgwKWS8)
- [model-00006-of-00006.safetensors:](https://mega.nz/file/2xQQBbKL#QMpL6l8bymBtAJnJPzZibcd8U3vv9b4BeQY7D4vcr0U)
After downloading , place all the safetensors files into the folder with the other configuration file in your local copy of the repository. **Ensure that the model loading scripts point to the correct directory**.
Run inference localy (follow tutorial on GitHub for more details)
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
MODEL_PATH = "./model" # Path to downloaded model files
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
model = AutoModelForCausalLM.from_pretrained(
MODEL_PATH,
device_map="auto",
trust_remote_code=True
)
prompt = (
"As a network specialist, explain in detail:\n\n"
"Q: How does BGP path selection work in large-scale networks?\n"
"A:"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.7,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
---
## Licence compliance
This model inherits Meta's LLaMA 3.1 License. Users must:
Accept Meta's license terms
Use only for non-commercial research
Provide attribution to both Meta and this project
---
Contributions are welcome! |