Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flyingfathead/gpt2-tensorflow-to-pytorch-converter
Convert TensorFlow-based GPT-2 models to Pytorch in a breeze
https://github.com/flyingfathead/gpt2-tensorflow-to-pytorch-converter
conversion converter gpt-2 gpt2 llm model openai python python3 pytorch pytorch-model pytorch-models tensorflow tensorflow-model tensorflow-models tensorflow2 tf2
Last synced: about 2 hours ago
JSON representation
Convert TensorFlow-based GPT-2 models to Pytorch in a breeze
- Host: GitHub
- URL: https://github.com/flyingfathead/gpt2-tensorflow-to-pytorch-converter
- Owner: FlyingFathead
- Created: 2024-07-23T15:32:18.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-07-23T20:26:49.000Z (2 months ago)
- Last Synced: 2024-09-23T08:02:33.822Z (4 days ago)
- Topics: conversion, converter, gpt-2, gpt2, llm, model, openai, python, python3, pytorch, pytorch-model, pytorch-models, tensorflow, tensorflow-model, tensorflow-models, tensorflow2, tf2
- Language: Python
- Homepage: https://github.com/FlyingFathead/gpt2-tensorflow-to-pytorch-converter
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gpt2-tensorflow-to-pytorch-converter
This repository contains a quick-to-use script to convert GPT-2 models from TensorFlow to PyTorch model format.
## Usage
1. Collect all your TensorFlow model files into a singular directory, i.e. these files:
```
model-.meta
vocab.bpe
model-.data-00000-of-00001
model-.index
checkpoint
counter
encoder.json
hparams.json
```2. Clone the repo, install prerequisites with i.e. `pip install -r requirements.txt` if needed.
3. Run the script:
```bash
python convert_model.py /path/to/your/model/files
```
4. The converted PyTorch model will be saved in the `./converted_model` directory.## Notes
Have fun, I probably won't be updating this one much.
## License
This project is licensed under the MIT License.
## Contribute
All code improvements are welcome. This should at least work on all TF1.x-based GPT-2 architecture models.
## About
- Flying from the mind of [FlyingFathead](https://github.com/FlyingFathead/)
- Digital ghost code by ChaosWhisperer