{"id":15065033,"url":"https://github.com/yusugomori/tftf","last_synced_at":"2025-04-10T13:09:12.177Z","repository":{"id":57474917,"uuid":"144355681","full_name":"yusugomori/tftf","owner":"yusugomori","description":"TensorFlow TransFormer🍔","archived":false,"fork":false,"pushed_at":"2018-09-20T05:18:27.000Z","size":149,"stargazers_count":36,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T11:45:57.472Z","etag":null,"topics":["deeplearning","python3","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yusugomori.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":"2018-08-11T04:37:47.000Z","updated_at":"2024-05-31T03:23:45.000Z","dependencies_parsed_at":"2022-09-10T04:03:36.631Z","dependency_job_id":null,"html_url":"https://github.com/yusugomori/tftf","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusugomori%2Ftftf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusugomori%2Ftftf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusugomori%2Ftftf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusugomori%2Ftftf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yusugomori","download_url":"https://codeload.github.com/yusugomori/tftf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248224659,"owners_count":21068073,"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":["deeplearning","python3","tensorflow"],"created_at":"2024-09-25T00:29:51.211Z","updated_at":"2025-04-10T13:09:12.153Z","avatar_url":"https://github.com/yusugomori.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TFTF: TensorFlow TransFormer🍔\n\nTensorFlow for everybody.\n\n## Quick glance\n\n```python\nfrom tftf.layers import Layer, Dense, Activation\nfrom tftf.models import Model\n\n'''\nBuild model\n'''\nmodel = Model()\nmodel.add(Dense(500, input_dim=784))\nmodel.add(Activation('sigmoid'))\nmodel.add(Dense(10))\nmodel.add(Activation('softmax'))\nmodel.compile()\n\nmodel.describe()\n\n'''\nTrain model\n'''\nmodel.fit(train_X, train_y)\n\n'''\nTest model\n'''\nprint(model.accuracy(test_X, test_y))\n```\n\nSee [examples](https://github.com/yusugomori/tftf/tree/master/examples) for other implementations.\n\n## Installation\n\n- **Install TFTF from PyPI (recommended):**\n\n```sh\npip install tensorflow\npip install tftf\n```\n\n- **Alternatively: install TFTF from the GitHub source:**\n\nFirst, clone TFTF using `git`:\n\n```sh\ngit clone https://github.com/yusugomori/tftf.git\n```\n\n Then, `cd` to the TFTF folder and run the install command:\n```sh\ncd tftf\nsudo python setup.py install\n```\n\n## Importable Layers, APIs\n\nYou can import low-level tftf APIs to your own TensorFlow implementations.\n\n```python\nfrom tftf.layers import Dense, Activation, NALU\nfrom tftf import initializers as ini\nfrom tftf import activations as act\nfrom tftf import losses as loss\nfrom tftf import optimizers as opt\nfrom tftf.metrics import accuracy, f1\n\nx = tf.placeholder(tf.float32, shape=[None, 784])\nt = tf.placeholder(tf.float32, shape=[None, 10])\n\n# import APIs\nW = ini.glorot_normal([784, 200])  # or just write tf.Variable(...)\nb = ini.zeros([200])\nh = act.tanh(tf.matmul(x, W) + b)  # or just write tf.nn.tanh(...)\n\n# import Layers\nh = Dense(200)(h)\nh = Activation('tanh')(h)\nh = NALU(200)(h)\n\nW = ini.glorot_normal([200, 10])\nb = ini.zeros([10])\ny = act.softmax(tf.matmul(h, W) + b)\n\ncost = loss.categorical_crossentropy(y, t)\ntrain_step = opt.sgd(0.01).minimize(cost)\n\n# Train\n#     ...\n\npreds = y.eval(session=sess, feed_dict={x: test_X})\nacc = accuracy(preds, test_y)\nf = f1(preds, test_y)\nprint('accuracy: {:.3}'.format(acc))\nprint('f1: {:.3}'.format(f))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusugomori%2Ftftf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyusugomori%2Ftftf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusugomori%2Ftftf/lists"}