Skip to content

Commit d781e63

Browse files
committed
Fix all module imports to use src. prefix
- Updated all imports from 'from langlab' to 'from src.langlab' - Updated all imports from 'import langlab' to 'import src.langlab' - Fixed imports in source files, test files, and notebook - Updated documentation examples to use correct import format - Added emergent/ directory to .gitignore to avoid nested repo issues - Fixed mypy type errors in test files by adding None checks for seed parameters - Updated patch decorators to use src. prefix - Applied black formatting to test files This ensures consistent import structure across the codebase.
1 parent e53ef69 commit d781e63

214 files changed

Lines changed: 394 additions & 99 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ Desktop.ini
7676

7777
# Project-specific
7878
outputs/
79-
mlruns/
79+
mlruns/emergent/

emergent_demo.ipynb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@
4343
"print(\"Setup complete!\")"
4444
]
4545
},
46-
{
47-
"cell_type": "markdown",
48-
"metadata": {},
49-
"source": [
50-
"## Imports and Configuration"
51-
]
52-
},
5346
{
5447
"cell_type": "code",
5548
"execution_count": null,
@@ -62,6 +55,13 @@
6255
"print(f\"Current working directory: {os.getcwd()}\")"
6356
]
6457
},
58+
{
59+
"cell_type": "markdown",
60+
"metadata": {},
61+
"source": [
62+
"## Imports and Configuration"
63+
]
64+
},
6565
{
6666
"cell_type": "code",
6767
"execution_count": null,
@@ -75,8 +75,8 @@
7575
"from tqdm import tqdm\n",
7676
"\n",
7777
"# Import the Language Emergence Lab components\n",
78-
"from langlab import Speaker, Listener, sample_scene, CommunicationConfig\n",
79-
"# from langlab.tracking import get_tracker\n",
78+
"from src.langlab import Speaker, Listener, sample_scene, CommunicationConfig\n",
79+
"# from src.langlab.tracking import get_tracker\n",
8080
"\n",
8181
"# Set device and random seeds for reproducibility\n",
8282
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
@@ -113,9 +113,7 @@
113113
"cell_type": "markdown",
114114
"metadata": {},
115115
"source": [
116-
"## Quick Demo: Language Emergence\n",
117-
"\n",
118-
"Let's run a simple referential game where Speaker and Listener agents learn to communicate about objects:"
116+
"## Language Emergence"
119117
]
120118
},
121119
{
@@ -151,7 +149,7 @@
151149
"outputs": [],
152150
"source": [
153151
"# Simple training loop for referential game\n",
154-
"from langlab.data.world import encode_object\n",
152+
"from src.langlab.data.world import encode_object\n",
155153
"\n",
156154
"def train_step(speaker, listener, scene_objects, target_idx, speaker_opt, listener_opt):\n",
157155
" \"\"\"Single training step for the referential game.\"\"\"\n",

mlruns/0/meta.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
artifact_location: file:///Users/bangyen/Documents/repos/emergent/mlruns/0
2+
creation_time: 1758663104290
3+
experiment_id: '0'
4+
last_update_time: 1758663104290
5+
lifecycle_stage: active
6+
name: Default
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
step,message_tokens
2+
10,4 9
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
step,total_loss,listener_loss,speaker_loss,accuracy,baseline,avg_message_length,message_length_std
2+
1,2.1836483478546143,1.7457435131072998,-0.10290645062923431,0.125,0.125,2.0,0.0
3+
2,1.569305419921875,1.668197751045227,-0.6098223924636841,0.0,0.1125,2.0,0.0
4+
3,1.8541359901428223,1.4145879745483398,-0.06721663475036621,0.125,0.11375,2.0,0.0
5+
4,2.7352170944213867,1.2841283082962036,0.9015294909477234,0.375,0.13987500000000003,2.0,0.0
6+
5,3.5193700790405273,2.33027982711792,0.6477879881858826,0.375,0.16338750000000005,2.0,0.0
7+
6,3.236365556716919,1.7701317071914673,0.9937160015106201,0.5,0.19704875000000005,2.0,0.0
8+
7,2.485442876815796,1.6607589721679688,0.3808002173900604,0.375,0.21484387500000005,2.0,0.0
9+
8,2.193753957748413,1.8029698133468628,-0.0985235869884491,0.25,0.21835948750000003,2.0,0.0
10+
9,2.1581127643585205,1.8627257347106934,-0.2044108510017395,0.125,0.20902353875000004,2.0,0.0
11+
10,2.0525310039520264,1.818827509880066,-0.2708447575569153,0.125,0.20062118487500005,2.0,0.0
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
artifact_uri: file:///Users/bangyen/Documents/repos/emergent/mlruns/409361739599493380/2f303dbb0d69468dbe33ab6e153fb300/artifacts
2+
end_time: 1758663105851
3+
entry_point_name: ''
4+
experiment_id: '409361739599493380'
5+
lifecycle_stage: active
6+
run_id: 2f303dbb0d69468dbe33ab6e153fb300
7+
run_name: train_k5_v16_l2_seed7
8+
source_name: ''
9+
source_type: 4
10+
source_version: ''
11+
start_time: 1758663105077
12+
status: 3
13+
tags: []
14+
user_id: bangyen
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.07
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

0 commit comments

Comments
 (0)