GraySoft
Projects Models About FAQ Contact Download guIDE →
Model Intelligence Sheet

richarderkhov/meta-llama_-_llamaguard-7b-gguf overview

You need to be logged in to the Hugging Face Hub to use the model. For more details, see this Colab notebook.

ggufarxiv:2307.09288arxiv:2312.04724endpoints_compatibleregion:usconversational
richarderkhov/meta-llama_-_llamaguard-7b-gguf visual
Downloads
192
Likes
1
Pipeline
Library
Visibility
Public
Access
Open

Repository Files & Downloads

21 files detected
Direct downloads for all repository files
FileTypeQuantizationSizeLink
LlamaGuard-7b.IQ3_M.gguf GGUF IQ3_M 2.90 GB Download
LlamaGuard-7b.IQ3_S.gguf GGUF IQ3_S 2.75 GB Download
LlamaGuard-7b.IQ3_XS.gguf GGUF IQ3_XS 2.60 GB Download
LlamaGuard-7b.IQ4_NL.gguf GGUF IQ4_NL 3.58 GB Download
LlamaGuard-7b.IQ4_XS.gguf GGUF IQ4_XS 3.40 GB Download
LlamaGuard-7b.Q2_K.gguf GGUF Q2_K 2.36 GB Download
LlamaGuard-7b.Q3_K.gguf GGUF Q3_K 3.07 GB Download
LlamaGuard-7b.Q3_K_L.gguf GGUF Q3_K_L 3.35 GB Download
LlamaGuard-7b.Q3_K_M.gguf GGUF Q3_K_M 3.07 GB Download
LlamaGuard-7b.Q3_K_S.gguf GGUF Q3_K_S 2.75 GB Download
LlamaGuard-7b.Q4_0.gguf GGUF 3.56 GB Download
LlamaGuard-7b.Q4_1.gguf GGUF 3.95 GB Download
LlamaGuard-7b.Q4_K.gguf GGUF Q4_K 3.80 GB Download
LlamaGuard-7b.Q4_K_M.gguf GGUF Q4_K_M 3.80 GB Download
LlamaGuard-7b.Q4_K_S.gguf GGUF Q4_K_S 3.59 GB Download
LlamaGuard-7b.Q5_0.gguf GGUF 4.33 GB Download
LlamaGuard-7b.Q5_1.gguf GGUF 4.72 GB Download
LlamaGuard-7b.Q5_K.gguf GGUF Q5_K 4.45 GB Download
LlamaGuard-7b.Q5_K_M.gguf GGUF Q5_K_M 4.45 GB Download
LlamaGuard-7b.Q5_K_S.gguf GGUF Q5_K_S 4.33 GB Download
LlamaGuard-7b.Q6_K.gguf GGUF Q6_K 5.15 GB Download

Model Details Live

Model Slug
richarderkhov/meta-llama_-_llamaguard-7b-gguf
Author
RichardErkhov
Pipeline Task
Library
Created
2024-04-21
Last Modified
2024-04-21
Gated
No
Private
No
HF SHA
912db2d3b905f22be23b4f64bfe38cb38f74877f
License
Unknown
Language
Unknown
Base Model
Unknown

Metadata Inspector

Normalized metadata (stored in metadata_json)
{
  "metadata": {},
  "card_data": {
    "frontmatter": {},
    "hero_image_url": "Llama-Guard_example.png",
    "summary": "``` > [!warning] > You need to be logged in to the Hugging Face Hub to use the model. For more details, see this Colab notebook.",
    "quick_links": [],
    "benchmark_table_html": "",
    "readme_markdown": "Quantization made by Richard Erkhov.\n\n[Github](https://github.com/RichardErkhov)\n\n[Discord](https://discord.gg/pvy7H8DZMG)\n\n[Request more models](https://github.com/RichardErkhov/quant_request)\n\n\nLlamaGuard-7b - GGUF\n- Model creator: https://huggingface.co/meta-llama/\n- Original model: https://huggingface.co/meta-llama/LlamaGuard-7b/\n\n\n| Name | Quant method | Size |\n| ---- | ---- | ---- |\n| [LlamaGuard-7b.Q2_K.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q2_K.gguf) | Q2_K | 2.36GB |\n| [LlamaGuard-7b.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.IQ3_XS.gguf) | IQ3_XS | 2.6GB |\n| [LlamaGuard-7b.IQ3_S.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.IQ3_S.gguf) | IQ3_S | 2.75GB |\n| [LlamaGuard-7b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q3_K_S.gguf) | Q3_K_S | 2.75GB |\n| [LlamaGuard-7b.IQ3_M.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.IQ3_M.gguf) | IQ3_M | 2.9GB |\n| [LlamaGuard-7b.Q3_K.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q3_K.gguf) | Q3_K | 3.07GB |\n| [LlamaGuard-7b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q3_K_M.gguf) | Q3_K_M | 3.07GB |\n| [LlamaGuard-7b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q3_K_L.gguf) | Q3_K_L | 3.35GB |\n| [LlamaGuard-7b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.IQ4_XS.gguf) | IQ4_XS | 3.4GB |\n| [LlamaGuard-7b.Q4_0.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q4_0.gguf) | Q4_0 | 3.56GB |\n| [LlamaGuard-7b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.IQ4_NL.gguf) | IQ4_NL | 3.58GB |\n| [LlamaGuard-7b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q4_K_S.gguf) | Q4_K_S | 3.59GB |\n| [LlamaGuard-7b.Q4_K.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q4_K.gguf) | Q4_K | 3.8GB |\n| [LlamaGuard-7b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q4_K_M.gguf) | Q4_K_M | 3.8GB |\n| [LlamaGuard-7b.Q4_1.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q4_1.gguf) | Q4_1 | 3.95GB |\n| [LlamaGuard-7b.Q5_0.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q5_0.gguf) | Q5_0 | 4.33GB |\n| [LlamaGuard-7b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q5_K_S.gguf) | Q5_K_S | 4.33GB |\n| [LlamaGuard-7b.Q5_K.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q5_K.gguf) | Q5_K | 4.45GB |\n| [LlamaGuard-7b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q5_K_M.gguf) | Q5_K_M | 4.45GB |\n| [LlamaGuard-7b.Q5_1.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q5_1.gguf) | Q5_1 | 4.72GB |\n| [LlamaGuard-7b.Q6_K.gguf](https://huggingface.co/RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf/blob/main/LlamaGuard-7b.Q6_K.gguf) | Q6_K | 5.15GB |\n\n\n\n\nOriginal model description:\n---\nextra_gated_heading: You need to share contact information with Meta to access this model\nextra_gated_prompt: >-\n  ### LLAMA 2 COMMUNITY LICENSE AGREEMENT\n\n  \"Agreement\" means the terms and conditions for use, reproduction, distribution\n  and  modification of the Llama Materials set forth herein. \n\n  \"Documentation\" means the specifications, manuals and documentation \n  accompanying Llama 2 distributed by Meta at\n  https://ai.meta.com/resources/models-and-libraries/llama-downloads/.  \n\n  \"Licensee\" or \"you\" means you, or your employer or any other person or entity\n  (if you are entering into this Agreement on such person or entity's behalf),\n  of the age required under applicable laws, rules or regulations to provide\n  legal consent and that has legal authority to bind your employer or such other\n  person or  entity if you are  entering in this Agreement on their behalf. \n\n  \"Llama 2\" means the foundational large language models and software and\n  algorithms, including machine-learning model code, trained model weights,\n  inference-enabling code, training-enabling code, fine-tuning enabling code and\n  other  elements of the foregoing distributed by Meta at\n  ai.meta.com/resources/models-and-libraries/llama-downloads/.\n\n  \"Llama Materials\" means, collectively, Meta's proprietary Llama 2 and\n  documentation (and any portion thereof) made available under this Agreement.\n\n  \"Meta\" or \"we\" means Meta Platforms Ireland Limited (if you are located in or,\n  if you are an entity, your principal place of business is in the EEA or\n  Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA\n  or Switzerland). \n\n\n  By clicking \"I Accept\" below or by using or distributing any portion or\n  element of the Llama Materials, you agree to be bound by this Agreement.\n\n  1. License Rights and Redistribution. \n\n  a. Grant of Rights. You are granted a non-exclusive, worldwide, non-\n  transferable and royalty-free limited license under Meta's intellectual\n  property or  other rights owned by Meta embodied in the Llama Materials to\n  use, reproduce,  distribute, copy, create derivative works of, and make\n  modifications to the Llama  Materials.  \n\n  b. Redistribution and Use.\n\n  i. If you distribute or make the Llama Materials, or any derivative works \n  thereof, available to a third party, you shall provide a copy of this\n  Agreement to such  third party. \n\n  ii.  If you receive Llama Materials, or any derivative works thereof, from  a\n  Licensee as part of an integrated end user product, then Section 2 of this \n  Agreement will not apply to you. \n\n  iii. You must retain in all copies of the Llama Materials that you  distribute\n  the following attribution notice within a \"Notice\" text file distributed as a \n  part of such copies: \"Llama 2 is licensed under the LLAMA 2 Community\n  License,  Copyright (c) Meta Platforms, Inc. All Rights Reserved.\"\n\n  iv. Your use of the Llama Materials must comply with applicable laws  and\n  regulations (including trade compliance laws and regulations) and adhere to\n  the  Acceptable Use Policy for the Llama Materials (available at \n  https://ai.meta.com/llama/use-policy), which is hereby incorporated by\n  reference into  this Agreement.\n\n  v. You will not use the Llama Materials or any output or results of the  Llama\n  Materials to improve any other large language model (excluding Llama 2 or \n  derivative works thereof).  \n\n\n  2. Additional Commercial Terms. If, on the Llama 2 version release date, the \n  monthly active users of the products or services made available by or for\n  Licensee,  or Licensee's affiliates, is greater than 700 million monthly\n  active users in the  preceding calendar month, you must request a license from\n  Meta, which Meta may  grant to you in its sole discretion, and you are not\n  authorized to exercise any of the  rights under this Agreement unless or until\n  Meta otherwise expressly grants you  such rights.\n\n  3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE  LLAMA\n  MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE  PROVIDED ON AN \"AS IS\"\n  BASIS, WITHOUT WARRANTIES OF ANY KIND,  EITHER EXPRESS OR IMPLIED, INCLUDING,\n  WITHOUT LIMITATION, ANY  WARRANTIES OF TITLE, NON-INFRINGEMENT,\n  MERCHANTABILITY, OR  FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY\n  RESPONSIBLE  FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING \n  THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR  USE OF THE\n  LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.\n\n  4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE  LIABLE\n  UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT,  NEGLIGENCE,\n  PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS  AGREEMENT, FOR ANY LOST\n  PROFITS OR ANY INDIRECT, SPECIAL,  CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR\n  PUNITIVE DAMAGES, EVEN  IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE\n  POSSIBILITY OF  ANY OF THE FOREGOING.\n\n\n  5. Intellectual Property.\n\n  a. No trademark licenses are granted under this Agreement, and in  connection\n  with the Llama Materials, neither Meta nor Licensee may use any name  or mark\n  owned by or associated with the other or any of its affiliates, except as \n  required for reasonable and customary use in describing and redistributing\n  the  Llama Materials.\n\n  b. Subject to Meta's ownership of Llama Materials and derivatives made by or \n  for Meta, with respect to any derivative works and modifications of the Llama \n  Materials that are made by you, as between you and Meta, you are and will be\n  the  owner of such derivative works and modifications.\n\n  c. If you institute litigation or other proceedings against Meta or any\n  entity  (including a cross-claim or counterclaim in a lawsuit) alleging that\n  the Llama  Materials or Llama 2 outputs or results, or any portion of any of\n  the foregoing,  constitutes infringement of intellectual property or other\n  rights owned or licensable  by you, then any licenses granted to you under\n  this Agreement shall terminate as of  the date such litigation or claim is\n  filed or instituted. You will indemnify and hold  harmless Meta from and\n  against any claim by any third party arising out of or related  to your use or\n  distribution of the Llama Materials.\n\n  6. Term and Termination. The term of this Agreement will commence upon your \n  acceptance of this Agreement or access to the Llama Materials and will\n  continue in  full force and effect until terminated in accordance with the\n  terms and conditions  herein. Meta may terminate this Agreement if you are in\n  breach of any term or  condition of this Agreement. Upon termination of this\n  Agreement, you shall delete  and cease use of the Llama Materials. Sections 3,\n  4 and 7 shall survive the  termination of this Agreement. \n\n  7. Governing Law and Jurisdiction. This Agreement will be governed and \n  construed under the laws of the State of California without regard to choice\n  of law  principles, and the UN Convention on Contracts for the International\n  Sale of Goods  does not apply to this Agreement. The courts of California\n  shall have exclusive  jurisdiction of any dispute arising out of this\n  Agreement. \n\n  ### Llama 2 Acceptable Use Policy\n\n  Meta is committed to promoting safe and fair use of its tools and features,\n  including Llama 2. If you access or use Llama 2, you agree to this Acceptable\n  Use Policy (“Policy”). The most recent copy of this policy can be found at\n  [ai.meta.com/llama/use-policy](http://ai.meta.com/llama/use-policy).\n\n  #### Prohibited Uses\n\n  We want everyone to use Llama 2 safely and responsibly. You agree you will not\n  use, or allow others to use, Llama 2 to:\n\n  1. Violate the law or others’ rights, including to:\n        1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as: \n            1. Violence or terrorism \n            2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material\n            3. Human trafficking, exploitation, and sexual violence\n            4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.\n            5. Sexual solicitation\n            6. Any other criminal activity\n        2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals\n        3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services\n        4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices \n        5. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws\n        6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama 2 Materials\n        7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system \n  2. Engage in, promote, incite, facilitate, or assist in the planning or\n  development of activities that present a risk of death or bodily harm to\n  individuals, including use of Llama 2 related to the following:\n      1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State\n      2. Guns and illegal weapons (including weapon development)\n      3. Illegal drugs and regulated/controlled substances\n      4. Operation of critical infrastructure, transportation technologies, or heavy machinery\n      5. Self-harm or harm to others, including suicide, cutting, and eating disorders\n      6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual\n  3. Intentionally deceive or mislead others, including use of Llama 2 related\n  to the following:\n      1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation\n      2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content\n      3. Generating, promoting, or further distributing spam\n      4. Impersonating another individual without consent, authorization, or legal right\n      5. Representing that the use of Llama 2 or outputs are human-generated\n      6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement \n      4. Fail to appropriately disclose to end users any known dangers of your AI system \n  Please report any violation of this Policy, software “bug,” or other problems\n  that could lead to a violation of this Policy through one of the following\n  means: \n      * Reporting issues with the model: [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama)\n      * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\n      * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info) \n      * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama: [LlamaUseReport@meta.com](mailto:LlamaUseReport@meta.com)\nextra_gated_fields:\n  First Name: text\n  Last Name: text\n  Date of birth: date_picker\n  Country: country\n  Affiliation: text\n  geo: ip_location\n  By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox\nextra_gated_description: >-\n  The information you provide will be collected, stored, processed and shared in\n  accordance with the [Meta Privacy\n  Policy](https://www.facebook.com/privacy/policy/).\nextra_gated_button_content: Submit\nlanguage:\n- en\npipeline_tag: text-generation\ntags:\n- facebook\n- meta\n- pytorch\n- llama\n- llama-2\nlicense: llama2\n---\n## Model Details\n\n**This repository contains the model weights both in the vanilla Llama format and the Hugging Face `transformers` format. If you have not received access, please review [this discussion](https://huggingface.co/meta-llama/LlamaGuard-7b/discussions/6)**\n\nLlama-Guard is a 7B parameter [Llama 2](https://arxiv.org/abs/2307.09288)-based input-output\nsafeguard model. It can be used for classifying content in both LLM inputs (prompt\nclassification) and in LLM responses (response classification).\nIt acts as an LLM: it generates text in its output that indicates whether a given prompt or\nresponse is safe/unsafe, and if unsafe based on a policy, it also lists the violating subcategories.\nHere is an example:\n\n![](Llama-Guard_example.png)\n\nIn order to produce classifier scores, we look at the probability for the first token, and turn that\ninto an “unsafe” class probability. Model users can then make binary decisions by applying a\ndesired threshold to the probability scores.\n\n## Training and Evaluation\n### Training Data\n\nWe use a mix of prompts that come from the Anthropic\n[dataset](https://huggingface.co/datasets/Anthropic/hh-rlhf) and redteaming examples that we have collected\nin house, in a separate process from our production redteaming. In particular, we took the\nprompts only from the Anthropic dataset, and generated new responses from our in-house\nLLaMA models, using jailbreaking techniques to elicit violating responses. We then annotated\nAnthropic data (prompts & responses) in house, mapping labels according to the categories\nidentified above. Overall we have ~13K training examples.\n\n## Taxonomy of harms and Risk Guidelines\n\nAs automated content risk mitigation relies on classifiers to make decisions\nabout content in real time, a prerequisite to building these systems is to have\nthe following components:\n- A **taxonomy** of risks that are of interest – these become the classes of a\nclassifier.\n- A **risk guideline** that determines where we put the line between encouraged\nand discouraged outputs for each risk category in the taxonomy.\nTogether with this model, we release an open taxonomy inspired by existing open\ntaxonomies such as those employed by Google, Microsoft and OpenAI in the hope\nthat it can be useful to the community. This taxonomy does not necessarily reflect Meta's\nown internal policies and is meant to demonstrate the value of our method to\ntune LLMs into classifiers that show high performance and high degrees of adaptability to different policies.\n\n### The Llama-Guard Safety Taxonomy & Risk Guidelines\n\nBelow, we provide both the harm types themselves under this taxonomy and also examples of\nthe specific kinds of content that would be considered harmful under each category:\n\n- **Violence & Hate** encompasses statements that encourage or could help people\nplan or engage in violence. Similarly, statements that advocate\ndiscrimination, contain slurs, or voice hateful sentiments against people\nbased on their sensitive personal characteristics (ex: race, color, religion,\nnational origin, sexual orientation, gender, gender identity, or disability)\nwould also be considered inappropriate under this category.\n- **Sexual Content** encompasses statements encouraging someone (who could be\nunderage) to engage in specific sex acts. Similarly, sexually explicit (i.e.,\nerotic) statements would also be considered inappropriate under this category.\n- **Guns & Illegal Weapons** encompasses statements that specifically encourage,\ncondone, or could help people plan or execute specific crimes involving the\nillegal acquisition, creation, or use of guns or illegal weapons (ex:\nexplosives, biological agents, or chemical weapons), including instructions on\nhow to create or use them.\n- **Regulated or Controlled Substances** encompasses statements that\nspecifically encourage or could help people to illegally produce, transfer, or\nconsume regulated or controlled substances like illegal drugs, tobacco,\nalcohol, or cannabis.\n- **Suicide & Self Harm** encompasses statements that encourage, condone, or\nenable people to harm themselves (ex: by providing instructions or information\non methods of self-harm). When people express or imply an intent to harm\nthemselves, any response other than one that provides links to appropriate\nhealth resources would be considered inappropriate (even if entirely\nsupportive).\n- **Criminal Planning** encompasses miscellaneous statements that encourage,\ncondone, or could help people plan or execute specific criminal activities,\nlike arson, kidnapping, or theft. Items should only be considered harmful\nunder this category when they could not be read as violating any of the other\nharm types above (ex: statements that encourage violence should be considered\nviolating under Violence & Hate rather than this category).\n\n\n## How to Use in `transformers`\n\n```py\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\nimport torch\n\nmodel_id = \"meta-llama/LlamaGuard-7b\"\ndevice = \"cuda\"\ndtype = torch.bfloat16\n\ntokenizer = AutoTokenizer.from_pretrained(model_id)\nmodel = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=dtype, device_map=device)\n\ndef moderate(chat):\n    input_ids = tokenizer.apply_chat_template(chat, return_tensors=\"pt\").to(device)\n    output = model.generate(input_ids=input_ids, max_new_tokens=100, pad_token_id=0)\n    prompt_len = input_ids.shape[-1]\n    return tokenizer.decode(output[0][prompt_len:], skip_special_tokens=True)\n\nmoderate([\n    {\"role\": \"user\", \"content\": \"I forgot how to kill a process in Linux, can you help?\"},\n    {\"role\": \"assistant\", \"content\": \"Sure! To kill a process in Linux, you can use the kill command followed by the process ID (PID) of the process you want to terminate.\"},\n])\n# `safe`\n```\n\n> [!warning]\n> You need to be logged in to the Hugging Face Hub to use the model.\n\nFor more details, see [this Colab notebook](https://colab.research.google.com/drive/16s0tlCSEDtczjPzdIK3jq0Le5LlnSYGf?usp=sharing).\n\n## Evaluation results\n\nWe compare the performance of the model against standard content moderation APIs\nin the industry, including\n[OpenAI](https://platform.openai.com/docs/guides/moderation/overview), [Azure Content Safety](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/harm-categories),and [PerspectiveAPI](https://developers.perspectiveapi.com/s/about-the-api-attributes-and-languages?language=en_US) from Google on both public and in-house benchmarks. The public benchmarks\ninclude [ToxicChat](https://huggingface.co/datasets/lmsys/toxic-chat) and\n[OpenAI Moderation](https://github.com/openai/moderation-api-release).\n\nNote: comparisons are not exactly apples-to-apples due to mismatches in each\ntaxonomy. The interested reader can find a more detailed discussion about this\nin [our paper](https://arxiv.org/abs/2312.04724).\n\n| | Our Test Set (Prompt) | OpenAI Mod | ToxicChat | Our Test Set (Response) |\n| --------------- | --------------------- | ---------- | --------- | ----------------------- |\n| Llama-Guard | **0.945** | 0.847 | **0.626** | **0.953** |\n| OpenAI API | 0.764 | **0.856** | 0.588 | 0.769 |\n| Perspective API | 0.728 | 0.787 | 0.532 | 0.699 |\n\n\n",
    "related_quantizations": []
  },
  "tags": [
    "gguf",
    "arxiv:2307.09288",
    "arxiv:2312.04724",
    "endpoints_compatible",
    "region:us",
    "conversational"
  ],
  "likes": 1,
  "downloads": 192,
  "gated": false,
  "private": false,
  "last_modified": "2024-04-21T11:09:06.000Z",
  "created_at": "2024-04-21T10:03:58.000Z",
  "pipeline_tag": "",
  "library_name": ""
}
Source payload excerpt (from Hugging Face API)
{
  "_id": "6624e48e49456ab7de5d4625",
  "id": "RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf",
  "modelId": "RichardErkhov/meta-llama_-_LlamaGuard-7b-gguf",
  "sha": "912db2d3b905f22be23b4f64bfe38cb38f74877f",
  "createdAt": "2024-04-21T10:03:58.000Z",
  "lastModified": "2024-04-21T11:09:06.000Z",
  "author": "RichardErkhov",
  "downloads": 192,
  "likes": 1,
  "gated": false,
  "private": false,
  "pipeline_tag": "",
  "library_name": "",
  "siblings_count": 23
}