{"id":19467621,"url":"https://github.com/thunlp/tensorflow-transx","last_synced_at":"2025-04-04T19:11:13.727Z","repository":{"id":41225863,"uuid":"86587269","full_name":"thunlp/TensorFlow-TransX","owner":"thunlp","description":"An implementation of TransE and its extended models for Knowledge Representation Learning on TensorFlow","archived":false,"fork":false,"pushed_at":"2022-11-03T06:41:56.000Z","size":6155,"stargazers_count":513,"open_issues_count":0,"forks_count":195,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-28T18:12:45.576Z","etag":null,"topics":["knowledge-embedding"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thunlp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-29T13:44:28.000Z","updated_at":"2025-02-19T13:45:08.000Z","dependencies_parsed_at":"2023-01-20T22:17:47.343Z","dependency_job_id":null,"html_url":"https://github.com/thunlp/TensorFlow-TransX","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FTensorFlow-TransX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FTensorFlow-TransX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FTensorFlow-TransX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FTensorFlow-TransX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thunlp","download_url":"https://codeload.github.com/thunlp/TensorFlow-TransX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["knowledge-embedding"],"created_at":"2024-11-10T18:36:15.159Z","updated_at":"2025-04-04T19:11:13.712Z","avatar_url":"https://github.com/thunlp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TensorFlow-TransX\n\nThis repository is a subproject of THU-OpenSK, and all subprojects of THU-OpenSK are as follows.\n\n- [OpenNE](https://www.github.com/thunlp/OpenNE)\n- [OpenKE](https://www.github.com/thunlp/OpenKE)\n  - [KB2E](https://www.github.com/thunlp/KB2E)\n  - [TensorFlow-Transx](https://www.github.com/thunlp/TensorFlow-Transx)\n  - [Fast-TransX](https://www.github.com/thunlp/Fast-TransX)\n- [OpenNRE](https://www.github.com/thunlp/OpenNRE)\n  - [JointNRE](https://www.github.com/thunlp/JointNRE)\n\nThe implementation of TransE [1], TransH [2], TransR [3], TransD [4] for knowledge representation learning (KRL). The overall framework is based on TensorFlow. We use C++ to implement some underlying operations such as data preprocessing and negative sampling. For each specific model, it is implemented by TensorFlow with Python interfaces so that there is a convenient platform to run models on GPUs. \n\nThese codes will be gradually integrated into the new framework [[OpenKE]](https://github.com/thunlp/openke).\n\n# Customizing Your Own Model\n\nIf you have a new idea and need to implement its code, you just need to change Python interfaces for your customized model. Read these codes, you will find that to change the class TransXModel will meet your needs.\n\n# Evaluation Results\n\nMore results about models can be found in (\"https://github.com/thunlp/KB2E\").\n\n# Data\n\nDatasets are required in the following format, containing three files:\n\ntriple2id.txt: training file, the first line is the number of triples for training. Then the follow lines are all in the format (e1, e2, rel).\n\nentity2id.txt: all entities and corresponding ids, one per line. The first line is the number of entities.\n\nrelation2id.txt: all relations and corresponding ids, one per line. The first line is the number of relations.\n\nYou can download FB15K and WN18 from [[Download]](https://github.com/thunlp/Fast-TransX/tree/master/data), and the more datasets can also be found in (\"https://github.com/thunlp/KB2E\").\n\n# Compile\n\nbash make.sh\n\n# Train\n\nTo train models based on random initialization:\n\n1. Change class Config in transX.py\n\n\t\tclass Config(object):\n\t\t\n\t\t\tdef __init__(self):\n\t\t\t\t...\n\t\t\t\tlib.setInPath(\"your training data path...\")\n\t\t\t\tself.testFlag = False\n\t\t\t\tself.loadFromData = False\n\t\t\t\t...\n\n2. python transX.py\n\nTo train models based on pretrained results:\n\n1. Change class Config in transX.py\n\n\t\tclass Config(object):\n\t\t\n\t\t\tdef __init__(self):\n\t\t\t\t...\n\t\t\t\tlib.setInPath(\"your training data path...\")\n\t\t\t\tself.testFlag = False\n\t\t\t\tself.loadFromData = True\n\t\t\t\t...\n\n2. python transX.py\n\n# Test\n\nTo test your models:\n\n1. Change class Config in transX.py\n\t\n\t\tclass Config(object):\n\t\t\n\t\t\tdef __init__(self):\n\t\t\t\t...\n\t\t\t\ttest_lib.setInPath(\"your testing data path...\")\n\t\t\t\tself.testFlag = True\n\t\t\t\tself.loadFromData = True\n\t\t\t\t...\n\n2. python transX.py\n\n\n\n# Citation\n\nIf you use the code, please kindly cite the papers listed in our reference.\n\n# Reference\n\n[1] Bordes, Antoine, et al. Translating embeddings for modeling multi-relational data. Proceedings of NIPS, 2013.\n\n[2]\tZhen Wang, Jianwen Zhang, et al. Knowledge Graph Embedding by Translating on Hyperplanes. Proceedings of AAAI, 2014.\n\n[3] Yankai Lin, Zhiyuan Liu, et al. Learning Entity and Relation Embeddings for Knowledge Graph Completion. Proceedings of AAAI, 2015.\n\n[4] Guoliang Ji, Shizhu He, et al. Knowledge Graph Embedding via Dynamic Mapping Matrix. Proceedings of ACL, 2015.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Ftensorflow-transx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthunlp%2Ftensorflow-transx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Ftensorflow-transx/lists"}