Download create_model.py from optimum-internal-testing/tiny-testing-gpt2-remote-code: direct link, hf CLI and curl.
- Browser
- Download file 358 Bytes
-
https://huggingface.co/optimum-internal-testing/tiny-testing-gpt2-remote-code/resolve/f4cac5bffb5839ca85c1df9e54ebdc60489e7eb5/create_model.py
- Command line
-
hf download hf://optimum-internal-testing/tiny-testing-gpt2-remote-code@f4cac5bffb5839ca85c1df9e54ebdc60489e7eb5/create_model.py
-
curl -L -o create_model.py https://huggingface.co/optimum-internal-testing/tiny-testing-gpt2-remote-code/resolve/f4cac5bffb5839ca85c1df9e54ebdc60489e7eb5/create_model.py
358 Bytes
| from transformers import AutoConfig | |
| from modeling.modeling_gpt2 import GPT2CustomLMHeadModel | |
| cfg = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-gpt2") | |
| GPT2CustomLMHeadModel.register_for_auto_class("AutoModelForCausalLM") | |
| model = GPT2CustomLMHeadModel(cfg) | |
| model.save_pretrained("/home/fxmarty/hf_internship/tiny-testing-gpt2-remote-code") | |