Views
No views yet
HuggingFaceTB/SmolLM2-1.7B-Instruct and is configured for causal language modeling. As a randomly initialized model, it produces incoherent outputs until trained, making it ideal for researchers studying transformer training dynamics or developing custom language models.HuggingFaceTB/SmolLM2-1.7B-Instructtie_word_embeddings=True), reducing parameter count by ~295M.transformers >= 4.45.0torch >= 2.01# Use a pipeline as a high-level helper
2from transformers import pipeline
3
4messages = [
5 {"role": "user", "content": "Who are you?"},
6]
7pipe = pipeline("text-generation", model="reflex-ai/random-llama-small")
8print(pipe(messages))Note: Outputs will be random and incoherent due to the model’s untrained state.
1from transformers import Trainer, TrainingArguments, DataCollatorForLanguageModeling, LlamaForCausalLM, AutoTokenizer
2
3model = LlamaForCausalLM.from_pretrained("your_username/random-llama-small")
4tokenizer = AutoTokenizer.from_pretrained("your_username/random-llama-small")
5
6training_args = TrainingArguments(
7 output_dir="./random_llama_small_finetuned",
8 per_device_train_batch_size=4,
9 num_train_epochs=3,
10 fp16=True,
11)
12
13trainer = Trainer(
14 model=model,
15 args=training_args,
16 train_dataset=your_dataset,
17 data_collator=DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False),
18)
19
20trainer.train()1{
2 "architectures": ["LlamaForCausalLM"],
3 "hidden_size": 2304,
4 "num_hidden_layers": 22,
5 "num_attention_heads": 36,
6 "num_key_value_heads": 9,
7 "intermediate_size": 9216,
8 "vocab_size": 128256,
9 "max_position_embeddings": 131072,
10 "rope_scaling": {
11 "factor": 32.0,
12 "high_freq_factor": 4.0,
13 "low_freq_factor": 1.0,
14 "original_max_position_embeddings": 8192,
15 "rope_type": "llama3"
16 },
17 "torch_dtype": "bfloat16",
18 "tie_word_embeddings": true
19}Model card created on April 20, 2025.