File size: 1,873 Bytes
a413b2f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | ---
license: apache-2.0
tags:
- pytorch
- gpt
- tiny-gpt
- causal-lm
---
# tiny-gpt-0.2-1m
This repository contains a pretrained TinyGPT checkpoint published for public use.
This checkpoint is provided for educational and experimentation purposes.
## Artifacts
- `tiny_gpt_checkpoint.pt`: training checkpoint with model and optimizer state
- `tokenizer.model`: SentencePiece tokenizer used for training and generation
- `config.json`: model configuration serialized from the checkpoint
- `training_config.yaml`: training and MLflow settings used for the run
## How to use
Use with Transformers.
Starting with `transformers >= 4.43.0`, you can run conversational inference using the `pipeline` abstraction or by leveraging the `Auto` classes with `generate()`.
Make sure to update your Transformers installation via `pip install --upgrade transformers`.
```python
import torch
import transformers
model_id = "vjkhambe/tiny-gpt-0.2-1m"
device = 0 if torch.cuda.is_available() else -1
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
model = transformers.AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=dtype,
)
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model.generation_config.max_length = None
model.generation_config.max_new_tokens = 64
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device=device,
)
print(pipeline("Hey how are you doing today?"))
```
## Training details
- Base package: `tiny_gpt_pretrain`
- Model and training configuration are stored in the checkpoint and `training_config.yaml`
- The exported checkpoint includes optimizer state for continued fine-tuning or evaluation
## License
Released under the Apache-2.0 license.
Target repo: `vjkhambe/tiny-gpt-0.2-1m`
|