Update README.md
Browse files1234530 unmodified lines36373839404142434445464748495051525354551 unmodified line575859606162636465666768---license: mittags:- gpt- language-model30 unmodified lines## Usage```pythonfrom transformers import AutoTokenizer, AutoModelForCausalLMmodel_id = "your-username/SP-LM-alpha"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id)# Generate textprompt = "Once upon a time"inputs = tokenizer(prompt, return_tensors="pt")outputs = model.generate(**inputs, max_length=100)print(tokenizer.decode(outputs[0]))```## Training Details- **Learning Rate**: 1e-4 with linear warmup and cosine annealing decay1 unmodified line- **Gradient Accumulation Steps**: 32- **Max Iterations**: 20000- **Optimizer**: AdamW with weight decay- **Mixed Precision**: bfloat16 / float16## LicenseMIT License## Model Card ContactFor questions or issues, please contact the model author.123430 unmodified lines3536373839404142434445464748495051525354555657585960616263646566676869707172737475767778791 unmodified line81828384---tags:- gpt- language-model30 unmodified lines## Usage### Quick Start```pythonfrom transformers import AutoTokenizerfrom huggingface_hub import hf_hub_downloadfrom safetensors.torch import load_fileimport jsonimport torchfrom sp_lm import GPTrepo_id = "wizardoftrap/SP-LM-alpha"tokenizer = AutoTokenizer.from_pretrained(repo_id)config_dict = json.load(open(hf_hub_download(repo_id=repo_id, filename="config.json")))config = type('Config', (), config_dict)()model_weights = load_file(hf_hub_download(repo_id=repo_id, filename="model.safetensors"))model = GPT(config)model.load_state_dict(model_weights)prompt = "Once upon a time"inputs = tokenizer(prompt, return_tensors="pt")with torch.no_grad():generated_ids = model.generate(inputs["input_ids"], max_new_tokens=50, temperature=1.0, top_k=50)print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))```### Installation1. Download `sp_lm.py` file from this repo for GPT model.2. Install required packages:```bashpip install transformers safetensors huggingface-hub torch```3. Load and generate text as shown above## Training Details- **Learning Rate**: 1e-4 with linear warmup and cosine annealing decay1 unmodified line- **Gradient Accumulation Steps**: 32- **Max Iterations**: 20000- **Optimizer**: AdamW with weight decay- **Mixed Precision**: bfloat16 / float16
README.md+33-17