Irfanuruchi's picture
Updating README
fc73351 verified
---
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
[![GitHub Repo](https://img.shields.io/badge/GitHub-Repo-181717?style=for-the-badge&logo=github)](https://github.com/IrfanUruchi/Llama-3.1-8B-Computer-Networks-LLM)
[![Model Weights](https://img.shields.io/badge/🤗-Model_Weights-FFD21F?style=for-the-badge)](https://huggingface.co/Irfanuruchi/Llama-3.1-8B-Computer-Networks-LLM)
[![License](https://img.shields.io/badge/License-LLaMA_3.1-blue.svg?style=for-the-badge)](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!