{"data":{"slug":"01-ai-yi","name":"Yi","tagline":"A series of large language models trained from scratch","github_url":"https://github.com/01-ai/Yi","owner":"01-ai","repo":"Yi","owner_avatar_url":"https://avatars.githubusercontent.com/u/139308978?v=4","primary_language":"Jupyter Notebook","stars":7822,"forks":491,"topics":["large-language-models"],"archived":false,"github_pushed_at":"2024-11-27T09:25:57+00:00","maintenance_label":"Dormant","stars_delta_30d":-2,"url":"https://www.graphcanon.com/tools/01-ai-yi","markdown_url":"https://www.graphcanon.com/tools/01-ai-yi.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/01-ai-yi","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=01-ai-yi","description":"A series of large language models trained from scratch by developers @01-ai","homepage_url":"https://01.ai","license":"Apache-2.0","open_issues":31,"watchers":108,"ai_summary":"Provides large language models and instructions for downloading the models and performing inference locally.","readme_excerpt":"## Quick start\n\n> **💡 Tip**: If you want to get started with the Yi model and explore different methods for inference, check out the [Yi Cookbook](https://github.com/01-ai/Yi/tree/main/Cookbook).\n\n---\n\n### Quick start - pip \n\nThis tutorial guides you through every step of running **Yi-34B-Chat locally on an A800 (80G)** and then performing inference.\n\n#### Step 0: Prerequisites\n\n- Make sure Python 3.10 or a later version is installed.\n\n- If you want to run other Yi models, see [software and hardware requirements](#deployment).\n\n#### Step 1: Prepare your environment \n\nTo set up the environment and install the required packages, execute the following command.\n\n```bash\ngit clone https://github.com/01-ai/Yi.git\ncd yi\npip install -r requirements.txt\n```\n\n#### Step 2: Download the Yi model\n\nYou can download the weights and tokenizer of Yi models from the following sources:\n\n- [Hugging Face](https://huggingface.co/01-ai)\n- [ModelScope](https://www.modelscope.cn/organization/01ai/)\n- [WiseModel](https://wisemodel.cn/organization/01.AI)\n\n#### Step 3: Perform inference\n\nYou can perform inference with Yi chat or base models as below.\n\n##### Perform inference with Yi chat model\n\n1. Create a file named  `quick_start.py` and copy the following content to it.\n\n    ```python\n    from transformers import AutoModelForCausalLM, AutoTokenizer\n\n    model_path = '<your-model-path>'\n\n    tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)\n\n    # Since transformers 4.35.0, the GPT-Q/AWQ model can be loaded using AutoModelForCausalLM.\n    model = AutoModelForCausalLM.from_pretrained(\n        model_path,\n        device_map=\"auto\",\n        torch_dtype='auto'\n    ).eval()\n\n    # Prompt content: \"hi\"\n    messages = [\n        {\"role\": \"user\", \"content\": \"hi\"}\n    ]\n\n    input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')\n    output_ids = model.generate(input_ids.to('cuda'))\n    response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)\n\n    # Model response: \"Hello! How can I assist you today?\"\n    print(response)\n    ```\n\n2. Run `quick_start.py`.\n\n    ```bash\n    python quick_start.py\n    ```\n\n    Then you can see an output similar to the one below. 🥳\n\n    ```bash\n    Hello! How can I assist you today?\n    ```\n\n##### Perform inference with Yi base model\n\n- Yi-34B\n\n  The steps are similar to [pip - Perform inference with Yi chat model](#perform-inference-with-yi-chat-model).\n\n  You can use the existing file [`text_generation.py`](https://github.com/01-ai/Yi/tree/main/demo).\n\n  ```bash\n  python demo/text_generation.py  --model <your-model-path>\n  ```\n\n  Then you can see an output similar to the one below. 🥳\n\n  <details>\n\n  <summary>Output. ⬇️ </summary>\n\n  <br>\n\n  **Prompt**: Let me tell you an interesting story about cat Tom and mouse Jerry,\n\n  **Generation**: Let me tell you an interesting story about cat Tom and mouse Jerry, which happened in my childhood. My father had a big house with two cats living inside it to kill mice. One day when I was playing at home alone, I found one of the tomcats lying on his back near our kitchen door, looking very much like he wanted something from us but couldn’t get up because there were too many people around him! He kept trying for several minutes before finally giving up...\n\n  </details>\n\n- Yi-9B\n  \n  Input\n\n  ```bash\n  from transformers import AutoModelForCausalLM, AutoTokenizer\n  \n  MODEL_DIR = \"01-ai/Yi-9B\"\n  model = AutoModelForCausalLM.from_pretrained(MODEL_DIR, torch_dtype=\"auto\")\n  tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR, use_fast=False)\n  \n  input_text = \"# write the quick sort algorithm\"\n  inputs = tokenizer(input_text, return_tensors=\"pt\").to(model.device)\n  outputs = model.generate(**inputs, max_length=256)\n  print(tokenizer.decode(outputs[0], skip_special_tokens=True))\n  ```\n\n  Output\n\n  ```bash\n  # write the quick sort algorithm\n  def quick_sort(arr):\n      if len(a","github_created_at":"2023-11-03T16:08:37+00:00","created_at":"2026-07-07T17:34:27.186664+00:00","updated_at":"2026-08-17T12:00:48.952102+00:00","categories":[{"slug":"inference-serving","name":"Inference & Serving","url":"https://www.graphcanon.com/categories/inference-serving","markdown_url":"https://www.graphcanon.com/categories/inference-serving.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/inference-serving"},{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"}],"tags":[{"slug":"inference","name":"inference"},{"slug":"large-language-models","name":"large language models"},{"slug":"model-download","name":"model-download"},{"slug":"python","name":"python"},{"slug":"transformers","name":"transformers"}],"trust":{"provenance":{"is_fork":false,"github_id":713967573,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-17T12:00:47.586Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":628,"last_release_at":null,"stars_delta_30d":-2,"open_issues_delta_30d":0},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":138,"high_count":0,"last_scan_at":"2026-07-11T11:03:21.700Z","medium_count":0,"scan_profile":"deps","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-17T12:00:48.378Z"},"deploy":{"source":"dockerfile:Dockerfile","self_host":true,"observed_at":"2026-08-17T12:00:48.378Z","managed_saas":false},"languages":{"value":["jupyter notebook","python"],"source":"github.language+pyproject.toml","observed_at":"2026-08-17T12:00:48.378Z"},"has_docker":{"value":true,"source":"dockerfile:Dockerfile","observed_at":"2026-08-17T12:00:48.378Z"},"license_spdx":{"value":"Apache-2.0","source":"github.license","observed_at":"2026-08-17T12:00:48.378Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["Use Yi when you need to perform local inference and have access to suitable hardware such as the A800 GPU.","Choose Yi if you want a model that can be fine-tuned for chat-specific tasks, as it offers both base and chat models with detailed instructions for setup."],"when_not_to_use":["Avoid using Yi if your local machine lacks sufficient memory or processing power to handle the large language models.","Do not select Yi when you prefer cloud-based solutions that do not require manual setup of a local environment and model download."],"source":"enrich:decision_facts","observed_at":"2026-07-15T10:27:35.412Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"Yi is a series of large language models designed for local deployment and inference. It supports running on specific hardware configurations like A800 with ample GPU memory."}]}}