Views
No views yet

| Steps | System Requirements |
|---|---|
| MoE Creation | > 44.8 GB System RAM |
| Inference (fp16) | GPU with > 12.4 GB VRAM |
1# git clone moetify fork that fixes dependency issue
2!git clone -b fix-transformers-4.47.1-FlashA2-dependency --single-branch https://github.com/davzoku/moetify.git
3
4!cd moetify && pip install -e .
5
6python -m moetify.mix \
7 --output_dir ./moecule-2x3b-m11-fk \
8 --model_path unsloth/llama-3.2-3b-Instruct \
9 --modules mlp q_proj \
10 --ingredients \
11 davzoku/finqa_expert_3b \
12 davzoku/kyc_expert_3b1INFO:root:Stem parameters: 1228581888
2INFO:root:Experts parameters: 4756340736
3INFO:root:Routers parameters: 344064
4INFO:root:MOE total parameters (numel): 5985266688
5INFO:root:MOE total parameters : 5985266688
6INFO:root:MOE active parameters: 59852666881# git clone moetify fork that fixes dependency issue
2!git clone -b fix-transformers-4.47.1-FlashA2-dependency --single-branch https://github.com/davzoku/moetify.git
3
4!cd moetify && pip install -e .
5
6model = AutoModelForCausalLM.from_pretrained(<model-name>, device_map='auto', trust_remote_code=True)
7tokenizer = AutoTokenizer.from_pretrained(<model-name>)
8
9def format_instruction(row):
10 return f"""### Question: {row}"""
11
12greedy_generation_config = GenerationConfig(
13 temperature=0.1,
14 top_p=0.75,
15 top_k=40,
16 num_beams=1,
17 max_new_tokens=128,
18 repetition_penalty=1.2
19)
20
21
22input_text = "In what ways did Siemens's debt restructuring on March 06, 2024 reflect its strategic priorities?"
23formatted_input = format_instruction(input_text)
24inputs = tokenizer(formatted_input, return_tensors="pt").to('cuda')
25
26with torch.no_grad():
27 outputs = model.generate(
28 input_ids=inputs.input_ids,
29 attention_mask=inputs.attention_mask,
30 generation_config=greedy_generation_config
31 )
32
33generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
34print(generated_text)