Views
No views yet
hidden_size = 768
intermediate_size = 2048
num_hidden_layers = 12
num_attention_heads = 12
num_key_value_heads = 12
max_position_embeddings = 1024
vocab_size = 50257
spiking_threshold = 1.0
ltc_hidden_size = 256
ltc_layers = 2pip install transformers torch numpyhttps://gist.github.com/harishsg993010/e632de8b15a3ab1ff03e3912f55109ea1# Note: This model requires custom implementation due to SNN/LTC architecture
2# Standard transformers library cannot load this model directly
3
4# For custom loading, you'll need the specialized architecture:
5from custom_model import LlamaSNNLTCModel
6from transformers import AutoTokenizer
7
8# Load tokenizer
9tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-small")
10tokenizer.pad_token = tokenizer.eos_token
11
12# Load the instruction-tuned model
13model = LlamaSNNLTCModel.from_pretrained("rootxhacker/arthemis-instruct")
14
15# For instruction-following generation
16def generate_instruction_response(instruction, input_text="", model=None, tokenizer=None, max_length=150):
17 model.eval()
18 device = next(model.parameters()).device
19
20 # Reset model states for clean generation
21 model.reset_states()
22
23 # Format prompt in Alpaca style
24 if input_text.strip():
25 prompt = f"### Instruction:\n{instruction}\n\n### Input:\n{input_text}\n\n### Response:\n"
26 else:
27 prompt = f"### Instruction:\n{instruction}\n\n### Response:\n"
28
29 inputs = tokenizer(prompt, return_tensors='pt').to(device)
30 input_ids = inputs['input_ids']
31
32 with torch.no_grad():
33 for _ in range(max_length - input_ids.shape[1]):
34 outputs = model(input_ids)
35 logits = outputs['logits'][0, -1, :]
36
37 # Sample with temperature for more natural responses
38 logits = logits / 0.7
39 probs = torch.softmax(logits, dim=-1)
40 next_token = torch.multinomial(probs, 1)
41
42 input_ids = torch.cat([input_ids, next_token.unsqueeze(0)], dim=-1)
43
44 if next_token.item() == tokenizer.eos_token_id:
45 break
46
47 generated = tokenizer.decode(input_ids[0], skip_special_tokens=True)
48
49 # Extract just the response part
50 if "### Response:\n" in generated:
51 response = generated.split("### Response:\n")[-1].strip()
52 return response
53
54 return generated
55
56# Example usage
57instruction = "Explain what artificial intelligence is in simple terms."
58response = generate_instruction_response(instruction, model=model, tokenizer=tokenizer)
59print(f"Instruction: {instruction}")
60print(f"Response: {response}")| Model | Params | Budget | HellaSwag | OBQA | WinoGrande | ARC_e | ARC_c | BoolQ | Avg |
|---|---|---|---|---|---|---|---|---|---|
| rootxhacker/arthemis-lm | 155.8M | <$50 | 24.65 | 20.60 | 48.10 | 28.20 | 22.20 | 39.80 | 30.59 |
| google/bert-large-uncased | 336M | N/A | 24.53 | 26.20 | 49.80 | 25.08 | 25.68 | 40.86 | 32.03 |
Architecture: Llama + Spiking Neural Networks + Liquid Time Constants
Hidden Size: 768
Intermediate Size: 2048
Attention Heads: 12
Layers: 12
Max Position Embeddings: 1024
Vocabulary Size: 50,257
Spiking Threshold: 1.0
LTC Hidden Size: 256
Training Precision: FP32
Fine-tuning Dataset: Alpaca Cleaned (52K instructions)1@misc{arthemis-instruct-2024,
2 title={Arthemis-Instruct: A Neuromorphic Instruction-Following Model with Spiking Neural Networks and Liquid Time Constants},
3 author={rootxhacker},
4 year={2024},
5 howpublished={\url{https://huggingface.co/rootxhacker/arthemis-instruct}}
6}