ereniko commited on
Commit
cd3d423
·
verified ·
1 Parent(s): 50a38d8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -5
README.md CHANGED
@@ -1,5 +1,114 @@
1
- ---
2
- license: apache-2.0
3
- base_model:
4
- - google-t5/t5-base
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - google-t5/t5-base
5
+ ---
6
+
7
+ # LaaLM — Linux as a Language Model
8
+
9
+ ## Model Description
10
+
11
+ LaaLM (Linux as a Language Model) is a fine-tuned T5-base model that simulates the textual output of Linux shell commands.
12
+
13
+ Given:
14
+
15
+ - a textual description of the current system state (working directory, files, environment), and
16
+
17
+ - a bash command,
18
+
19
+ the model predicts what the command would output if executed in a Linux environment.
20
+
21
+ This is intended as a ***research and experimentation model***, not a real shell replacement.
22
+
23
+ ## How It Works
24
+
25
+ Input format:
26
+ ```
27
+ System: <system state description>
28
+ User: <bash command>
29
+ ```
30
+
31
+ Output:
32
+
33
+ ```
34
+ <predicted stdout / stderr>
35
+ ```
36
+
37
+ The system state is dynamically generated externally and passed to the model as text.
38
+ The model does not maintain internal state, it only predicts output from the provided context.
39
+
40
+ ## Example
41
+
42
+ ### Input
43
+ ```
44
+ System: Current directory: /home/user
45
+ Files in current directory:
46
+ - test.txt (empty)
47
+ Environment: USER=user, HOME=/home/user
48
+ User: ls
49
+ ```
50
+ ### Output
51
+ ```
52
+ test.txt
53
+
54
+ ```
55
+ ## Intended Use
56
+
57
+ - Research into learned environment simulation
58
+ - Studying command semantics and error modeling
59
+ - Dataset generation experiments
60
+ - Educational exploration
61
+
62
+ ## Limitations
63
+
64
+ - This model does not execute real commands.
65
+ - Even though it's also trained on cases where it's supposed to error out it may still hallucinate incorrect behavior for unseen commands or edge cases.
66
+ - File system state must be maintained externally.
67
+ - Output accuracy depends heavily on how closely the prompt matches the training format.
68
+ - Not suitable for safety-critical or production systems.
69
+
70
+ ## Commands It Knows
71
+
72
+ - pwd
73
+ - echo
74
+ - cat
75
+ - ls
76
+ - mkdir
77
+ - touch
78
+
79
+ Any other commands than these might either give wrong results or fail.
80
+
81
+ ## Training
82
+
83
+ - Base model: T5-base
84
+ - Fine-tuned on synthetic Linux command datasets
85
+ - Mixed-precision training on NVIDIA V100 GPU
86
+ - Approximately 80k training samples
87
+
88
+ ## Quick Usage
89
+
90
+ ```python
91
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
92
+ import torch
93
+
94
+ model_id = "ereniko/LaaLM-v1"
95
+
96
+ tokenizer = T5Tokenizer.from_pretrained(model_id)
97
+ model = T5ForConditionalGeneration.from_pretrained(model_id).cuda()
98
+ model.eval()
99
+
100
+ def run_command(system_state, command):
101
+ prompt = f"System: {system_state}\nUser: {command}"
102
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
103
+
104
+ with torch.no_grad():
105
+ output = model.generate(
106
+ **inputs,
107
+ max_new_tokens=128,
108
+ do_sample=False
109
+ )
110
+
111
+ return tokenizer.decode(output[0], skip_special_tokens=True)
112
+
113
+ print(run_command("Current directory: /home/user", "pwd"))
114
+ ```