| --- |
| base_model: |
| - Kukedlc/NeuralSirKrishna-7b |
| - Kukedlc/NeuralArjuna-7B-DT |
| - Kukedlc/NeuralMaths-Experiment-7b |
| - Kukedlc/NeuralSynthesis-7B-v0.1 |
| library_name: transformers |
| tags: |
| - mergekit |
| - merge |
| license: apache-2.0 |
| --- |
| |
| # NeuralStockFusion-7b |
|
|
|  |
|
|
| # merge |
|
|
| This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit). |
|
|
| ## Merge Details |
| ### Merge Method |
|
|
| This model was merged using the [Model Stock](https://arxiv.org/abs/2403.19522) merge method using [Kukedlc/NeuralSirKrishna-7b](https://huggingface.co/Kukedlc/NeuralSirKrishna-7b) as a base. |
|
|
| ### Models Merged |
|
|
| The following models were included in the merge: |
| * [Kukedlc/NeuralArjuna-7B-DT](https://huggingface.co/Kukedlc/NeuralArjuna-7B-DT) |
| * [Kukedlc/NeuralMaths-Experiment-7b](https://huggingface.co/Kukedlc/NeuralMaths-Experiment-7b) |
| * [Kukedlc/NeuralSynthesis-7B-v0.1](https://huggingface.co/Kukedlc/NeuralSynthesis-7B-v0.1) |
|
|
| ### Configuration |
|
|
| The following YAML configuration was used to produce this model: |
|
|
| ```yaml |
| models: |
| - model: Kukedlc/NeuralMaths-Experiment-7b |
| - model: Kukedlc/NeuralArjuna-7B-DT |
| - model: Kukedlc/NeuralSirKrishna-7b |
| - model: Kukedlc/NeuralSynthesis-7B-v0.1 |
| merge_method: model_stock |
| base_model: Kukedlc/NeuralSirKrishna-7b |
| dtype: bfloat16 |
| |
| ``` |
|
|
| # Model Inference: |
|
|
| ``` python |
| !pip install -qU transformers accelerate bitsandbytes |
| |
| from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, BitsAndBytesConfig |
| import torch |
| |
| bnb_config = BitsAndBytesConfig( |
| load_in_4bit=True, |
| bnb_4bit_use_double_quant=True, |
| bnb_4bit_quant_type="nf4", |
| bnb_4bit_compute_dtype=torch.bfloat16 |
| ) |
| |
| MODEL_NAME = 'Kukedlc/NeuralStockFusion-7b' |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) |
| model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map='cuda:0', quantization_config=bnb_config) |
| |
| inputs = tokenizer(["[INST] What is a large language model, in spanish \n[/INST]\n"], return_tensors="pt").to('cuda') |
| streamer = TextStreamer(tokenizer) |
| |
| # Despite returning the usual output, the streamer will also print the generated text to stdout. |
| _ = model.generate(**inputs, streamer=streamer, max_new_tokens=256, do_sample=True, temperature=0.7, repetition_penalty=1.4, top_p=0.9) |
| ``` |