Skip to content

Commit

Permalink
add gpt to models
Browse files Browse the repository at this point in the history
  • Loading branch information
AutoJenkins committed Nov 29, 2023
1 parent 38cb4f2 commit dff609a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions brainscore_language/models/gpt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@

model_registry['gpt-neo-1.3B'] = lambda: HuggingfaceSubject(model_id='EleutherAI/gpt-neo-1.3B', region_layer_mapping={
ArtificialSubject.RecordingTarget.language_system: 'transformer.h.18'})

model_registry['gpt-j-6b'] = lambda: HuggingfaceSubject(model_id='EleutherAI/gpt-j-6b', region_layer_mapping={
ArtificialSubject.RecordingTarget.language_system: 'transformer.h.26'})
11 changes: 8 additions & 3 deletions brainscore_language/models/gpt/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
('gpt-neo-2.7B', [np.nan, 15.07522869, 3.6358602 , 0.04999408, 1.42219079,
0.0399301 , 0.02614061, 0.02547451]),
('gpt-neo-1.3B', [np.nan, 15.36009979, 5.54412651, 0.11744193, 0.60116327,
0.04266951, 0.08952015, 0.09213546])
0.04266951, 0.08952015, 0.09213546]),
('gpt-j-6b', [np.nan, 1.335768e+01, 1.618860e+00, 1.210055e-02,
3.879260e-01, 4.501237e-02, 5.057606e-02, 9.547059e-02]),
])
def test_reading_times(model_identifier, expected_reading_times):
model = load_model(model_identifier)
Expand All @@ -44,7 +47,8 @@ def test_reading_times(model_identifier, expected_reading_times):
('gpt2-xl', ['jumps', 'the', 'dog']),
('gpt-neo-125m', [',', 'the', 'dog']),
('gpt-neo-2.7B', ['jumps', 'the', 'dog']),
('gpt-neo-1.3B', ['jumps', 'the', 'dog'])
('gpt-neo-1.3B', ['jumps', 'the', 'dog']),
('gpt-j-6b', ['jumps', 'the', 'dog']),
])
def test_next_word(model_identifier, expected_next_words):
model = load_model(model_identifier)
Expand All @@ -64,7 +68,8 @@ def test_next_word(model_identifier, expected_next_words):
('gpt2-xl', 1600),
('gpt-neo-125m', 768),
('gpt-neo-1.3B', 2048),
('gpt-neo-2.7B', 2560)
('gpt-neo-2.7B', 2560),
('gpt-j-6b', 4096),
])
def test_neural(model_identifier, feature_size):
model = load_model(model_identifier)
Expand Down

0 comments on commit dff609a

Please sign in to comment.