Skip to content

code for generating "definition trees" for (not-necessarily-token) GPT-J embeddings

Notifications You must be signed in to change notification settings

mwatkins1970/GPT_definition_trees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The main function here is definition_trees.py. This builds the JSON definition tree structure. mutant_prompting.py and token_utils are subsidiary to this.

To rund definition_trees.py, you'll first have to have loaded EleutherAI/gpt-j-6B (or other model) as 'GPTmodel', along with its tokenizer as 'tokenizer' and its shape embeddings tensor as 'embeddings'

You'll also need to specify 'save_directory' for the resulting .json file to be saved to.

Once .json files have been built and saved, visualise_trees.py can be used to produce PNG tree images. Increasing the DPI may be necessary for very large trees generated with very small cutoff, that's in this line:

dot.attr(rankdir='LR', size='8,8', margin='0.2', nodesep='0.06', ranksep='5', dpi=600, bgcolor='white')      

About

code for generating "definition trees" for (not-necessarily-token) GPT-J embeddings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages