1from transformers import AutoTokenizer, pipeline, logging
2from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
3import argparse
45model_name_or_path ="TheBloke/Redmond-Hermes-Coder-GPTQ"6model_basename ="model"78use_triton =False910tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)1112model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,13 model_basename=model_basename,14 use_safetensors=True,15 trust_remote_code=False,16 device="cuda:0",17 use_triton=use_triton,18 quantize_config=None)1920prompt ="Tell me about AI"21prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
2223### Instruction: PROMPT
2425### Response:
2627'''2829print("\n\n*** Generate:")3031input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()32output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)33print(tokenizer.decode(output[0]))3435# Inference can also be done using transformers' pipeline3637# Prevent printing spurious transformers error when using pipeline with AutoGPTQ38logging.set_verbosity(logging.CRITICAL)3940print("*** Pipeline:")41pipe = pipeline(42"text-generation",43 model=model,44 tokenizer=tokenizer,45 max_new_tokens=512,46 temperature=0.7,47 top_p=0.95,48 repetition_penalty=1.1549)5051print(pipe(prompt_template)[0]['generated_text'])
Provided files
gptq_model-4bit-128g.safetensors
This will work with AutoGPTQ and CUDA versions of GPTQ-for-LLaMa. There are reports of issues with Triton mode of recent GPTQ-for-LLaMa. If you have issues, please use AutoGPTQ instead.
If a Llama model, it will also be supported by ExLlama, which will provide 2x speedup over AutoGPTQ and GPTQ-for-LLaMa.
It was created with group_size 128 to increase inference accuracy, but without --act-order (desc_act) to increase compatibility and improve inference speed.
gptq_model-4bit-128g.safetensors
Works with AutoGPTQ in CUDA or Triton modes.
Does NOT work with ExLlama as it's not a Llama model.
Works with GPTQ-for-LLaMa in CUDA mode. May have issues with GPTQ-for-LLaMa Triton mode.
Works with text-generation-webui, including one-click-installers.
Parameters: Groupsize = 128. Act Order / desc_act = False.
Discord
For further support, and discussions on these models and AI in general, join us at:
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
Patreon special mentions: Sam, theTransient, Jonathan Leane, Steven Wood, webtim, Johann-Peter Hartmann, Geoffrey Montalvo, Gabriel Tamborski, Willem Michiel, John Villwock, Derek Yates, Mesiah Bishop, Eugene Pentland, Pieter, Chadd, Stephen Murray, Daniel P. Andersen, terasurfer, Brandon Frisco, Thomas Belote, Sid, Nathan LeClaire, Magnesian, Alps Aficionado, Stanislav Ovsiannikov, Alex, Joseph William Delisle, Nikolai Manek, Michael Davis, Junyu Yang, K, J, Spencer Kim, Stefan Sabev, Olusegun Samson, transmissions 11, Michael Levine, Cory Kujawski, Rainer Wilmers, zynix, Kalila, Luke @flexchar, Ajan Kanaga, Mandus, vamX, Ai Maven, Mano Prime, Matthew Berman, subjectnull, Vitor Caleffi, Clay Pascal, biorpg, alfie_i, 阿明, Jeffrey Morgan, ya boyyy, Raymond Fosdick, knownsqashed, Olakabola, Leonard Tan, ReadyPlayerEmma, Enrico Ros, Dave, Talal Aujan, Illia Dulskyi, Sean Connelly, senxiiz, Artur Olbinski, Elle, Raven Klaugh, Fen Risland, Deep Realms, Imad Khwaja, Fred von Graf, Will Dee, usrbinkat, SuperWojo, Alexandros Triantafyllidis, Swaroop Kallakuri, Dan Guido, John Detwiler, Pedro Madruga, Iucharbius, Viktor Bowallius, Asp the Wyvern, Edmond Seymore, Trenton Dambrowitz, Space Cruiser, Spiking Neurons AB, Pyrater, LangChain4j, Tony Hughes, Kacper Wikieł, Rishabh Srivastava, David Ziegler, Luke Pendergrass, Andrey, Gabriel Puliatti, Lone Striker, Sebastain Graf, Pierre Kircher, Randy H, NimbleBox.ai, Vadim, danny, Deo Leter
Thank you to all my generous patrons and donaters!
And thank you again to a16z for their generous grant.
Original model card: NousResearch's Redmond Hermes Coder
Model Card: Redmond-Hermes-Coder 15B
Model Description
Redmond-Hermes-Coder 15B is a state-of-the-art language model fine-tuned on over 300,000 instructions. This model was fine-tuned by Nous Research, with Teknium and Karan4D leading the fine tuning process and dataset curation, Redmond AI sponsoring the compute, and several other contributors.
This model was trained with a WizardCoder base, which itself uses a StarCoder base model.
The model is truly great at code, but, it does come with a tradeoff though. While far better at code than the original Nous-Hermes built on Llama, it is worse than WizardCoder at pure code benchmarks, like HumanEval.
It comes in at 39% on HumanEval, with WizardCoder at 57%. This is a preliminary experiment, and we are exploring improvements now.
However, it does seem better at non-code than WizardCoder on a variety of things, including writing tasks.
Model Training
The model was trained almost entirely on synthetic GPT-4 outputs. This includes data from diverse sources such as GPTeacher, the general, roleplay v1&2, code instruct datasets, Nous Instruct & PDACTL (unpublished), CodeAlpaca, Evol_Instruct Uncensored, GPT4-LLM, and Unnatural Instructions.
Additional data inputs came from Camel-AI's Biology/Physics/Chemistry and Math Datasets, Airoboros' (v1) GPT-4 Dataset, and more from CodeAlpaca. The total volume of data encompassed over 300,000 instructions.
Collaborators
The model fine-tuning and the datasets were a collaboration of efforts and resources from members of Nous Research, includingTeknium, Karan4D, Huemin Art, and Redmond AI's generous compute grants.
Huge shoutout and acknowledgement is deserved for all the dataset creators who generously share their datasets openly.
Among the contributors of datasets, GPTeacher was made available by Teknium, Wizard LM by nlpxucan, and the Nous Research Instruct Dataset was provided by Karan4D and HueminArt.
The GPT4-LLM and Unnatural Instructions were provided by Microsoft, Airoboros dataset by jondurbin, Camel-AI datasets are from Camel-AI, and CodeAlpaca dataset by Sahil 2801.
If anyone was left out, please open a thread in the community tab.
The model is currently being uploaded in FP16 format, and there are plans to convert the model to GGML and GPTQ 4bit quantizations. The team is also working on a full benchmark, similar to what was done for GPT4-x-Vicuna. We will try to get in discussions to get the model included in the GPT4All.
The model is available for download on Hugging Face. It is suitable for a wide range of language tasks, from generating creative text to understanding and following complex instructions.
Compute provided by our project sponsor Redmond AI, thank you!!