Views
No views yet

1models:
2 - model: Kukedlc/NeuralMaths-Experiment-7b
3 - model: Kukedlc/NeuralArjuna-7B-DT
4 - model: Kukedlc/NeuralSirKrishna-7b
5 - model: Kukedlc/NeuralSynthesis-7B-v0.1
6merge_method: model_stock
7base_model: Kukedlc/NeuralSirKrishna-7b
8dtype: bfloat16
91!pip install -qU transformers accelerate bitsandbytes
2
3from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, BitsAndBytesConfig
4import torch
5
6bnb_config = BitsAndBytesConfig(
7 load_in_4bit=True,
8 bnb_4bit_use_double_quant=True,
9 bnb_4bit_quant_type="nf4",
10 bnb_4bit_compute_dtype=torch.bfloat16
11)
12
13MODEL_NAME = 'Kukedlc/NeuralStockFusion-7b'
14tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
15model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map='cuda:0', quantization_config=bnb_config)
16
17inputs = tokenizer(["[INST] What is a large language model, in spanish \n[/INST]\n"], return_tensors="pt").to('cuda')
18streamer = TextStreamer(tokenizer)
19
20# Despite returning the usual output, the streamer will also print the generated text to stdout.
21_ = model.generate(**inputs, streamer=streamer, max_new_tokens=256, do_sample=True, temperature=0.7, repetition_penalty=1.4, top_p=0.9)