CINXE.COM
GitHub - QwenLM/Qwen: The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.
<!DOCTYPE html> <html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system" data-a11y-link-underlines="true" > <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com"> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-7aa84bb7e11e.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-f65db3e8d171.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-a8258e3c6dda.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-7e97d834719c.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-01d869f460be.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-534f3e971240.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-a8cc7d138001.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-35e9dfdc4f9f.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-cf4cc5f62dfe.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-d9abecd14f1e.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-93aded0ee8a1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-8bed0685a4b5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-a954a02d9269.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repository-4fce88777fa8.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-0210be90f4d3.css" /> <script type="application/json" id="client-env">{"locale":"en","featureFlags":["bypass_copilot_indexing_quota","copilot_immersive_file_preview","copilot_new_references_ui","copilot_attach_folder_reference","copilot_personal_instructions","copilot_personal_instructions_templates","copilot_chat_repo_custom_instructions_preview","copilot_chat_retry_on_error","copilot_chat_persist_submitted_input","copilot_conversational_ux_history_refs","copilot_chat_shared_chat_input","copilot_chat_shared_topic_indicator","copilot_chat_shared_repo_sso_banner","copilot_editor_upsells","copilot_dotcom_chat_reduce_telemetry","copilot_implicit_context","copilot_no_floating_button","copilot_smell_icebreaker_ux","copilot_read_shared_conversation","dotcom_chat_client_side_skills","experimentation_azure_variant_endpoint","failbot_handle_non_errors","geojson_azure_maps","ghost_pilot_confidence_truncation_25","ghost_pilot_confidence_truncation_40","github_models_o3_mini_streaming","hovercard_accessibility","issues_react_remove_placeholders","issues_react_blur_item_picker_on_close","issues_react_include_bots_in_pickers","marketing_pages_search_explore_provider","remove_child_patch","sample_network_conn_type","swp_enterprise_contact_form","site_copilot_vscode_link_update","site_proxima_australia_update","issues_react_create_milestone","issues_react_cache_fix_workaround","lifecycle_label_name_updates"]}</script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-11b03c1efd35.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_oddbird_popover-polyfill_dist_popover_js-9da652f58479.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_arianotify-polyfill_ariaNotify-polyfill_js-node_modules_github_mi-3abb8f-d7e6bc799724.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_failbot_failbot_ts-4600dbf2d60a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-f04cb2a9fc8c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_index_mjs-0dbb79f97f8f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-f690fd9ae3d5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-f6da4b3fa34c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-8e9f78-a74b4e0a8a6b.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_text-expander-element_dist_index_js-78748950cb0c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-b5f1d7-a1760ffda83d.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_markdown-toolbar-element_dist_index_js-ceef33f593fa.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-c44a69-f0c8a795d1fd.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-44d18ad044b3.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-a8213dacfcb6.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_braintree_browser-detection_dist_browser-detection_js-node_modules_githu-2906d7-2a07a295af40.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-be8cb88f481b.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_morphdom_dist_morphdom-e-7c534c-a4a1922eb55f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_turbo_dist_turbo_es2017-esm_js-e3cbe28f1638.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-893f9f-6cf3320416b8.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-e3180fe3bcb3.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_quote-selection_dist_index_js-node_modules_github_session-resume_-947061-205cd97df772.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_updatable-content_updatable-content_ts-a1563f62660e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_task-list_ts-app_assets_modules_github_sso_ts-ui_packages-900dde-f48a418a99d4.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-8fa27fd7fbb6.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_ajax-error_ts-app_assets_modules_github_behaviors_include-87a4ae-e2caa5390f5a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-783fc7e142e5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-44598a9103f2.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-f6223d90c7ba.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-e12489347ccf.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_template-parts_lib_index_js-96453a51f920.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-eecf0d50276f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-0a7bffd2f129.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-fe2c516230f3.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-3eebbd-0763620ad7bf.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_decorators_js-node_modules_delegated-events_di-e161aa-9d41fb1b6c9e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_remote--3c9c82-7238cfcdaa51.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-a4509a8583cd.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_catalyst_lib_inde-dbbea9-26cce2010167.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-6a5f60eab447.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/primer-react-8e38c0ecf8b7.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/react-core-4128f7c95445.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/react-lib-f1bca44e0926.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/octicons-react-611691cca2f6.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_emotion_is-prop-valid_dist_emotion-is-prop-valid_esm_js-node_modules_emo-62da9f-2df2f32ec596.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_stacktrace-parser_dist_s-e7dcdd-f7cc96ebae76.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_oddbird_popover-polyfill_dist_popover-fn_js-55fea94174bf.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-subscriptions-menu-eff84ecbf2b6.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.5a0ffaf77c0db0d0dac2.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/notifications-subscriptions-menu.1bcff9205c241e99cff2.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.5a0ffaf77c0db0d0dac2.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/notifications-subscriptions-menu.1bcff9205c241e99cff2.module.css" /> <title>GitHub - QwenLM/Qwen: The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.</title> <meta name="route-pattern" content="/:user_id/:repository" data-turbo-transient> <meta name="route-controller" content="files" data-turbo-transient> <meta name="route-action" content="disambiguate" data-turbo-transient> <meta name="current-catalog-service-hash" content="f3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb"> <meta name="request-id" content="9880:13134A:F85D0:14A9E6:67B504FD" data-pjax-transient="true"/><meta name="html-safe-nonce" content="eb840f3a4d364e44f52e6ddce7abb1080b4fee8c4e1688b27694fa18d2b4bcfb" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODgwOjEzMTM0QTpGODVEMDoxNEE5RTY6NjdCNTA0RkQiLCJ2aXNpdG9yX2lkIjoiNDY4MzE0ODAxODIwNTM5NDE3MyIsInJlZ2lvbl9lZGdlIjoic291dGhlYXN0YXNpYSIsInJlZ2lvbl9yZW5kZXIiOiJzb3V0aGVhc3Rhc2lhIn0=" data-pjax-transient="true"/><meta name="visitor-hmac" content="a828eca8e895eb957296d71f4607b65cc631f6dc39574e42a2fcd72569fab0b4" data-pjax-transient="true"/> <meta name="hovercard-subject-tag" content="repository:674075444" data-turbo-transient> <meta name="github-keyboard-shortcuts" content="repository,copilot" data-turbo-transient="true" /> <meta name="selected-link" value="repo_source" data-turbo-transient> <link rel="assets" href="https://github.githubassets.com/"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I"> <meta name="octolytics-url" content="https://collector.github.com/github/collect" /> <meta name="analytics-location" content="/<user-name>/<repo-name>" data-turbo-transient="true" /> <meta name="user-login" content=""> <meta name="viewport" content="width=device-width"> <meta name="description" content="The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. - QwenLM/Qwen"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/QwenLM/Qwen" /> <meta name="twitter:image" content="https://opengraph.githubassets.com/06db932534e8fa6c47512be54d6feaab19a8962f2d15d0f050f8084a9049f3c2/QwenLM/Qwen" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="GitHub - QwenLM/Qwen: The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud." /><meta name="twitter:description" content="The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. - QwenLM/Qwen" /> <meta property="og:image" content="https://opengraph.githubassets.com/06db932534e8fa6c47512be54d6feaab19a8962f2d15d0f050f8084a9049f3c2/QwenLM/Qwen" /><meta property="og:image:alt" content="The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. - QwenLM/Qwen" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="GitHub - QwenLM/Qwen: The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud." /><meta property="og:url" content="https://github.com/QwenLM/Qwen" /><meta property="og:description" content="The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. - QwenLM/Qwen" /> <meta name="hostname" content="github.com"> <meta name="expected-hostname" content="github.com"> <meta http-equiv="x-pjax-version" content="53e494453a282ada5ca94c764e4179ebc68c9fa6f9c639f91c83e61fa0964d31" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="ace39c3b6632770952207593607e6e0be0db363435a8b877b1f96abe6430f345" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="1c71206221e00a0a8e77d94d48d954f34ddbd711c4a0ced954fd49cd786cfa61" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="f55930a4ccd496d3eaa92529869ddea68e263d317b84941e96b450022c87a889" data-turbo-track="reload"> <meta name="turbo-cache-control" content="no-preview" data-turbo-transient=""> <meta data-hydrostats="publish"> <meta name="go-import" content="github.com/QwenLM/Qwen git https://github.com/QwenLM/Qwen.git"> <meta name="octolytics-dimension-user_id" content="141221163" /><meta name="octolytics-dimension-user_login" content="QwenLM" /><meta name="octolytics-dimension-repository_id" content="674075444" /><meta name="octolytics-dimension-repository_nwo" content="QwenLM/Qwen" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="674075444" /><meta name="octolytics-dimension-repository_network_root_nwo" content="QwenLM/Qwen" /> <link rel="canonical" href="https://github.com/QwenLM/Qwen" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive"> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="mask-icon" href="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg" data-base-href="https://github.githubassets.com/favicons/favicon"> <meta name="theme-color" content="#1e2327"> <meta name="color-scheme" content="light dark" /> <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials"> </head> <body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div class="position-relative header-wrapper js-header-wrapper "> <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a> <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full"> <span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span> </span> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_ui-commands_ui-commands_ts-e571874765ef.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-765cf28766da.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.5a0ffaf77c0db0d0dac2.module.css" /> <react-partial partial-name="keyboard-shortcuts-dialog" data-ssr="false" data-attempted-ssr="false" > <script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}</script> <div data-target="react-partial.reactRoot"></div> </react-partial> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-73b675cf164a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-2d195d11c56b.js"></script> <header class="HeaderMktg header-logged-out js-details-container js-header Details f4 py-3" role="banner" data-is-top="true" data-color-mode=light data-light-theme=light data-dark-theme=dark> <h2 class="sr-only">Navigation Menu</h2> <button type="button" class="HeaderMktg-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span class="d-none">Toggle navigation</span> </button> <div class="d-flex flex-column flex-lg-row flex-items-center px-3 px-md-4 px-lg-5 height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <div class="flex-1"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target js-nav-padding-recalculate js-header-menu-toggle Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span class="Button-content"> <span class="Button-label"><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span> </button> </div> <a class="mr-lg-3 color-fg-inherit flex-order-2 js-prevent-focus-on-mobile-nav" href="/" aria-label="Homepage" data-analytics-event="{"category":"Marketing nav","action":"click to go to homepage","label":"ref_page:Marketing;ref_cta:Logomark;ref_loc:Header"}"> <svg height="32" aria-hidden="true" viewBox="0 0 24 24" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M12.5.75C6.146.75 1 5.896 1 12.25c0 5.089 3.292 9.387 7.863 10.91.575.101.79-.244.79-.546 0-.273-.014-1.178-.014-2.142-2.889.532-3.636-.704-3.866-1.35-.13-.331-.69-1.352-1.18-1.625-.402-.216-.977-.748-.014-.762.906-.014 1.553.834 1.769 1.179 1.035 1.74 2.688 1.25 3.349.948.1-.747.402-1.25.733-1.538-2.559-.287-5.232-1.279-5.232-5.678 0-1.25.445-2.285 1.178-3.09-.115-.288-.517-1.467.115-3.048 0 0 .963-.302 3.163 1.179.92-.259 1.897-.388 2.875-.388.977 0 1.955.13 2.875.388 2.2-1.495 3.162-1.179 3.162-1.179.633 1.581.23 2.76.115 3.048.733.805 1.179 1.825 1.179 3.09 0 4.413-2.688 5.39-5.247 5.678.417.36.776 1.05.776 2.128 0 1.538-.014 2.774-.014 3.162 0 .302.216.662.79.547C20.709 21.637 24 17.324 24 12.25 24 5.896 18.854.75 12.5.75Z"></path> </svg> </a> <div class="flex-1 flex-order-2 text-right"> <a href="/login?return_to=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen" class="HeaderMenu-link HeaderMenu-button d-inline-flex d-lg-none flex-order-1 f5 no-underline border color-border-default rounded-2 px-2 py-1 color-fg-inherit js-prevent-focus-on-mobile-nav" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="604069e8d7875177589400da3d5c6c6f8cc1db1475227b59ea4dfa1671c50232" data-analytics-event="{"category":"Marketing nav","action":"click to Sign in","label":"ref_page:Marketing;ref_cta:Sign in;ref_loc:Header"}" > Sign in </a> </div> </div> <div class="HeaderMenu js-header-menu height-fit position-lg-relative d-lg-flex flex-column flex-auto top-0"> <div class="HeaderMenu-wrapper d-flex flex-column flex-self-start flex-lg-row flex-auto rounded rounded-lg-0"> <nav class="HeaderMenu-nav" aria-label="Global"> <ul class="d-lg-flex list-style-none"> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"github_copilot","context":"product","tag":"link","label":"github_copilot_link_product_navbar"}" href="https://github.com/features/copilot"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"></path><path d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"></path> </svg> <div> <div class="color-fg-default h4">GitHub Copilot</div> Write better code with AI </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"security","context":"product","tag":"link","label":"security_link_product_navbar"}" href="https://github.com/features/security"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path> </svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"actions","context":"product","tag":"link","label":"actions_link_product_navbar"}" href="https://github.com/features/actions"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path> </svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"codespaces","context":"product","tag":"link","label":"codespaces_link_product_navbar"}" href="https://github.com/features/codespaces"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path> </svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"issues","context":"product","tag":"link","label":"issues_link_product_navbar"}" href="https://github.com/features/issues"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path> </svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"code_review","context":"product","tag":"link","label":"code_review_link_product_navbar"}" href="https://github.com/features/code-review"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path> </svg> <div> <div class="color-fg-default h4">Code Review</div> Manage code changes </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"discussions","context":"product","tag":"link","label":"discussions_link_product_navbar"}" href="https://github.com/features/discussions"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path> </svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"code_search","context":"product","tag":"link","label":"code_search_link_product_navbar"}" href="https://github.com/features/code-search"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-square color-fg-subtle mr-3"> <path d="M10.3 8.24a.75.75 0 0 1-.04 1.06L7.352 12l2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M2 3.75C2 2.784 2.784 2 3.75 2h16.5c.966 0 1.75.784 1.75 1.75v16.5A1.75 1.75 0 0 1 20.25 22H3.75A1.75 1.75 0 0 1 2 20.25Zm1.75-.25a.25.25 0 0 0-.25.25v16.5c0 .138.112.25.25.25h16.5a.25.25 0 0 0 .25-.25V3.75a.25.25 0 0 0-.25-.25Z"></path> </svg> <div> <div class="color-fg-default h4">Code Search</div> Find more, search less </div> </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="product-explore-heading">Explore</span> <ul class="list-style-none f5" aria-labelledby="product-explore-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"all_features","context":"product","tag":"link","label":"all_features_link_product_navbar"}" href="https://github.com/features"> All features </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"documentation","context":"product","tag":"link","label":"documentation_link_product_navbar"}" href="https://docs.github.com"> Documentation <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"github_skills","context":"product","tag":"link","label":"github_skills_link_product_navbar"}" href="https://skills.github.com"> GitHub Skills <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"blog","context":"product","tag":"link","label":"blog_link_product_navbar"}" href="https://github.blog"> Blog <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 pb-lg-3 mb-3 mb-lg-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-company-size-heading">By company size</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-company-size-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"enterprises","context":"solutions","tag":"link","label":"enterprises_link_solutions_navbar"}" href="https://github.com/enterprise"> Enterprises </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"small_and_medium_teams","context":"solutions","tag":"link","label":"small_and_medium_teams_link_solutions_navbar"}" href="https://github.com/team"> Small and medium teams </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"startups","context":"solutions","tag":"link","label":"startups_link_solutions_navbar"}" href="https://github.com/enterprise/startups"> Startups </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"nonprofits","context":"solutions","tag":"link","label":"nonprofits_link_solutions_navbar"}" href="/solutions/industry/nonprofits"> Nonprofits </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-use-case-heading">By use case</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-use-case-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devsecops","context":"solutions","tag":"link","label":"devsecops_link_solutions_navbar"}" href="/solutions/use-case/devsecops"> DevSecOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devops","context":"solutions","tag":"link","label":"devops_link_solutions_navbar"}" href="/solutions/use-case/devops"> DevOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"ci_cd","context":"solutions","tag":"link","label":"ci_cd_link_solutions_navbar"}" href="/solutions/use-case/ci-cd"> CI/CD </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all_use_cases","context":"solutions","tag":"link","label":"view_all_use_cases_link_solutions_navbar"}" href="/solutions/use-case"> View all use cases </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-industry-heading">By industry</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-industry-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"healthcare","context":"solutions","tag":"link","label":"healthcare_link_solutions_navbar"}" href="/solutions/industry/healthcare"> Healthcare </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"financial_services","context":"solutions","tag":"link","label":"financial_services_link_solutions_navbar"}" href="/solutions/industry/financial-services"> Financial services </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"manufacturing","context":"solutions","tag":"link","label":"manufacturing_link_solutions_navbar"}" href="/solutions/industry/manufacturing"> Manufacturing </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"government","context":"solutions","tag":"link","label":"government_link_solutions_navbar"}" href="/solutions/industry/government"> Government </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all_industries","context":"solutions","tag":"link","label":"view_all_industries_link_solutions_navbar"}" href="/solutions/industry"> View all industries </a></li> </ul> </div> </div> <div class="HeaderMenu-trailing-link rounded-bottom-2 flex-shrink-0 mt-lg-4 px-lg-4 py-4 py-lg-3 f5 text-semibold"> <a href="/solutions"> View all solutions <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-right HeaderMenu-trailing-link-icon"> <path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path> </svg> </a> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Resources <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="resources-topics-heading">Topics</span> <ul class="list-style-none f5" aria-labelledby="resources-topics-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"ai","context":"resources","tag":"link","label":"ai_link_resources_navbar"}" href="/resources/articles/ai"> AI </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devops","context":"resources","tag":"link","label":"devops_link_resources_navbar"}" href="/resources/articles/devops"> DevOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"security","context":"resources","tag":"link","label":"security_link_resources_navbar"}" href="/resources/articles/security"> Security </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"software_development","context":"resources","tag":"link","label":"software_development_link_resources_navbar"}" href="/resources/articles/software-development"> Software Development </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all","context":"resources","tag":"link","label":"view_all_link_resources_navbar"}" href="/resources/articles"> View all </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="resources-explore-heading">Explore</span> <ul class="list-style-none f5" aria-labelledby="resources-explore-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"learning_pathways","context":"resources","tag":"link","label":"learning_pathways_link_resources_navbar"}" href="https://resources.github.com/learn/pathways"> Learning Pathways <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"white_papers_ebooks_webinars","context":"resources","tag":"link","label":"white_papers_ebooks_webinars_link_resources_navbar"}" href="https://resources.github.com"> White papers, Ebooks, Webinars <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"customer_stories","context":"resources","tag":"link","label":"customer_stories_link_resources_navbar"}" href="https://github.com/customer-stories"> Customer Stories </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"partners","context":"resources","tag":"link","label":"partners_link_resources_navbar"}" href="https://partner.github.com"> Partners <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"executive_insights","context":"resources","tag":"link","label":"executive_insights_link_resources_navbar"}" href="https://github.com/solutions/executive-insights"> Executive Insights </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 px-lg-4"> <div class="HeaderMenu-column"> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"github_sponsors","context":"open_source","tag":"link","label":"github_sponsors_link_open_source_navbar"}" href="/sponsors"> <div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"the_readme_project","context":"open_source","tag":"link","label":"the_readme_project_link_open_source_navbar"}" href="https://github.com/readme"> <div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="open-source-repositories-heading">Repositories</span> <ul class="list-style-none f5" aria-labelledby="open-source-repositories-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"topics","context":"open_source","tag":"link","label":"topics_link_open_source_navbar"}" href="https://github.com/topics"> Topics </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"trending","context":"open_source","tag":"link","label":"trending_link_open_source_navbar"}" href="https://github.com/trending"> Trending </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"collections","context":"open_source","tag":"link","label":"collections_link_open_source_navbar"}" href="https://github.com/collections"> Collections </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Enterprise <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 px-lg-4"> <div class="HeaderMenu-column"> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"enterprise_platform","context":"enterprise","tag":"link","label":"enterprise_platform_link_enterprise_navbar"}" href="/enterprise"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-stack color-fg-subtle mr-3"> <path d="M11.063 1.456a1.749 1.749 0 0 1 1.874 0l8.383 5.316a1.751 1.751 0 0 1 0 2.956l-8.383 5.316a1.749 1.749 0 0 1-1.874 0L2.68 9.728a1.751 1.751 0 0 1 0-2.956Zm1.071 1.267a.25.25 0 0 0-.268 0L3.483 8.039a.25.25 0 0 0 0 .422l8.383 5.316a.25.25 0 0 0 .268 0l8.383-5.316a.25.25 0 0 0 0-.422Z"></path><path d="M1.867 12.324a.75.75 0 0 1 1.035-.232l8.964 5.685a.25.25 0 0 0 .268 0l8.964-5.685a.75.75 0 0 1 .804 1.267l-8.965 5.685a1.749 1.749 0 0 1-1.874 0l-8.965-5.685a.75.75 0 0 1-.231-1.035Z"></path><path d="M1.867 16.324a.75.75 0 0 1 1.035-.232l8.964 5.685a.25.25 0 0 0 .268 0l8.964-5.685a.75.75 0 0 1 .804 1.267l-8.965 5.685a1.749 1.749 0 0 1-1.874 0l-8.965-5.685a.75.75 0 0 1-.231-1.035Z"></path> </svg> <div> <div class="color-fg-default h4">Enterprise platform</div> AI-powered developer platform </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="enterprise-available-add-ons-heading">Available add-ons</span> <ul class="list-style-none f5" aria-labelledby="enterprise-available-add-ons-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"advanced_security","context":"enterprise","tag":"link","label":"advanced_security_link_enterprise_navbar"}" href="https://github.com/enterprise/advanced-security"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path> </svg> <div> <div class="color-fg-default h4">Advanced Security</div> Enterprise-grade security features </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"github_copilot","context":"enterprise","tag":"link","label":"github_copilot_link_enterprise_navbar"}" href="/features/copilot#enterprise"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"></path><path d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"></path> </svg> <div> <div class="color-fg-default h4">GitHub Copilot</div> Enterprise-grade AI features </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"premium_support","context":"enterprise","tag":"link","label":"premium_support_link_enterprise_navbar"}" href="/premium-support"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path> </svg> <div> <div class="color-fg-default h4">Premium Support</div> Enterprise-grade 24/7 support </div> </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <a class="HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block" data-analytics-event="{"location":"navbar","action":"pricing","context":"global","tag":"link","label":"pricing_link_global_navbar"}" href="https://github.com/pricing">Pricing</a> </li> </ul> </nav> <div class="d-flex flex-column flex-lg-row width-full flex-justify-end flex-lg-items-center text-center mt-3 mt-lg-0 text-lg-left ml-lg-3"> <qbsearch-input class="search-input" data-scope="repo:QwenLM/Qwen" data-custom-scopes-path="/search/custom_scopes" data-delete-custom-scopes-csrf="5khktTdOuQUniP11Qphncz--oOtdEXowIGanrP-qXdFYPFi5C__B1KzheR5lwAWzYS8DSDdOjyrPQVxtw3p9cg" data-max-custom-scopes="10" data-header-redesign-enabled="false" data-initial-value="" data-blackbird-suggestions-path="/search/suggestions" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" data-current-repository="QwenLM/Qwen" data-current-org="QwenLM" data-current-owner="" data-logged-in="false" data-copilot-chat-enabled="false" data-nl-search-enabled="false" data-retain-scroll-position="true"> <div class="search-input-container search-with-dialog position-relative d-flex flex-row flex-items-center mr-4 rounded" data-action="click:qbsearch-input#searchInputContainerClicked" > <button type="button" class="header-search-button placeholder input-button form-control d-flex flex-1 flex-self-stretch flex-items-center no-wrap width-full py-0 pl-2 pr-0 text-left border-0 box-shadow-none" data-target="qbsearch-input.inputButton" aria-label="Search or jump to…" aria-haspopup="dialog" placeholder="Search or jump to..." data-hotkey=s,/ autocapitalize="off" data-analytics-event="{"location":"navbar","action":"searchbar","context":"global","tag":"input","label":"searchbar_input_global_navbar"}" data-action="click:qbsearch-input#handleExpand" > <div class="mr-2 color-fg-muted"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </div> <span class="flex-1" data-target="qbsearch-input.inputButtonText">Search or jump to...</span> <div class="d-flex" data-target="qbsearch-input.hotkeyIndicator"> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg> </div> </button> <input type="hidden" name="type" class="js-site-search-type-field"> <div class="Overlay--hidden " data-modal-dialog-overlay> <modal-dialog data-action="close:qbsearch-input#handleClose cancel:qbsearch-input#handleClose" data-target="qbsearch-input.searchSuggestionsDialog" role="dialog" id="search-suggestions-dialog" aria-modal="true" aria-labelledby="search-suggestions-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto"> <h1 id="search-suggestions-dialog-header" class="sr-only">Search code, repositories, users, issues, pull requests...</h1> <div class="Overlay-body Overlay-body--paddingNone"> <div data-view-component="true"> <div class="search-suggestions position-fixed width-full color-shadow-large border color-fg-default color-bg-default overflow-hidden d-flex flex-column query-builder-container" style="border-radius: 12px;" data-target="qbsearch-input.queryBuilderContainer" hidden > <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="query-builder-test-form" action="" accept-charset="UTF-8" method="get"> <query-builder data-target="qbsearch-input.queryBuilder" id="query-builder-query-builder-test" data-filter-key=":" data-view-component="true" class="QueryBuilder search-query-builder"> <div class="FormControl FormControl--fullWidth"> <label id="query-builder-test-label" for="query-builder-test" class="FormControl-label sr-only"> Search </label> <div class="QueryBuilder-StyledInput width-fit " data-target="query-builder.styledInput" > <span id="query-builder-test-leadingvisual-wrap" class="FormControl-input-leadingVisualWrap QueryBuilder-leadingVisualWrap"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search FormControl-input-leadingVisual"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </span> <div data-target="query-builder.styledInputContainer" class="QueryBuilder-StyledInputContainer"> <div aria-hidden="true" class="QueryBuilder-StyledInputContent" data-target="query-builder.styledInputContent" ></div> <div class="QueryBuilder-InputWrapper"> <div aria-hidden="true" class="QueryBuilder-Sizer" data-target="query-builder.sizer"></div> <input id="query-builder-test" name="query-builder-test" value="" autocomplete="off" type="text" role="combobox" spellcheck="false" aria-expanded="false" aria-describedby="validation-df9c70ea-14ea-4a34-a4fa-38a1513abdad" data-target="query-builder.input" data-action=" input:query-builder#inputChange blur:query-builder#inputBlur keydown:query-builder#inputKeydown focus:query-builder#inputFocus " data-view-component="true" class="FormControl-input QueryBuilder-Input FormControl-medium" /> </div> </div> <span class="sr-only" id="query-builder-test-clear">Clear</span> <button role="button" id="query-builder-test-clear-button" aria-labelledby="query-builder-test-clear query-builder-test-label" data-target="query-builder.clearButton" data-action=" click:query-builder#clear focus:query-builder#clearButtonFocus blur:query-builder#clearButtonBlur " variant="small" hidden="hidden" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium mr-1 px-2 py-0 d-flex flex-items-center rounded-1 color-fg-muted"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x-circle-fill Button-visual"> <path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path> </svg> </button> </div> <template id="search-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </template> <template id="code-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </template> <template id="file-code-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-code"> <path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path> </svg> </template> <template id="history-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path> </svg> </template> <template id="repo-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path> </svg> </template> <template id="bookmark-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bookmark"> <path d="M3 2.75C3 1.784 3.784 1 4.75 1h6.5c.966 0 1.75.784 1.75 1.75v11.5a.75.75 0 0 1-1.227.579L8 11.722l-3.773 3.107A.751.751 0 0 1 3 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.91l3.023-2.489a.75.75 0 0 1 .954 0l3.023 2.49V2.75a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="plus-circle-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-plus-circle"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7.25-3.25v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5a.75.75 0 0 1 1.5 0Z"></path> </svg> </template> <template id="circle-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> </template> <template id="trash-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-trash"> <path d="M11 1.75V3h2.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H5V1.75C5 .784 5.784 0 6.75 0h2.5C10.216 0 11 .784 11 1.75ZM4.496 6.675l.66 6.6a.25.25 0 0 0 .249.225h5.19a.25.25 0 0 0 .249-.225l.66-6.6a.75.75 0 0 1 1.492.149l-.66 6.6A1.748 1.748 0 0 1 10.595 15h-5.19a1.75 1.75 0 0 1-1.741-1.575l-.66-6.6a.75.75 0 1 1 1.492-.15ZM6.5 1.75V3h3V1.75a.25.25 0 0 0-.25-.25h-2.5a.25.25 0 0 0-.25.25Z"></path> </svg> </template> <template id="team-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-people"> <path d="M2 5.5a3.5 3.5 0 1 1 5.898 2.549 5.508 5.508 0 0 1 3.034 4.084.75.75 0 1 1-1.482.235 4 4 0 0 0-7.9 0 .75.75 0 0 1-1.482-.236A5.507 5.507 0 0 1 3.102 8.05 3.493 3.493 0 0 1 2 5.5ZM11 4a3.001 3.001 0 0 1 2.22 5.018 5.01 5.01 0 0 1 2.56 3.012.749.749 0 0 1-.885.954.752.752 0 0 1-.549-.514 3.507 3.507 0 0 0-2.522-2.372.75.75 0 0 1-.574-.73v-.352a.75.75 0 0 1 .416-.672A1.5 1.5 0 0 0 11 5.5.75.75 0 0 1 11 4Zm-5.5-.5a2 2 0 1 0-.001 3.999A2 2 0 0 0 5.5 3.5Z"></path> </svg> </template> <template id="project-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path> </svg> </template> <template id="pencil-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-pencil"> <path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.081-.286.235-.547.445-.758l8.61-8.61Zm.176 4.823L9.75 4.81l-6.286 6.287a.253.253 0 0 0-.064.108l-.558 1.953 1.953-.558a.253.253 0 0 0 .108-.064Zm1.238-3.763a.25.25 0 0 0-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 0 0 0-.354Z"></path> </svg> </template> <template id="copilot-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copilot"> <path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path> </svg> </template> <template id="copilot-error-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copilot-error"> <path d="M16 11.24c0 .112-.072.274-.21.467L13 9.688V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-.198 0-.388-.009-.571-.029L6.833 5.226a4.01 4.01 0 0 0 .17-.782c.117-.935-.037-1.395-.241-1.614-.193-.206-.637-.413-1.682-.297-.683.076-1.115.231-1.395.415l-1.257-.91c.579-.564 1.413-.877 2.485-.996 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095Zm-5.083-8.707c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Zm2.511 11.074c-1.393.776-3.272 1.428-5.43 1.428-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.18-.455-.241-.963-.252-1.475L.31 4.107A.747.747 0 0 1 0 3.509V3.49a.748.748 0 0 1 .625-.73c.156-.026.306.047.435.139l14.667 10.578a.592.592 0 0 1 .227.264.752.752 0 0 1 .046.249v.022a.75.75 0 0 1-1.19.596Zm-1.367-.991L5.635 7.964a5.128 5.128 0 0 1-.889.073c-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433 1.539 0 3.089-.505 4.063-.934Z"></path> </svg> </template> <template id="workflow-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-workflow"> <path d="M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="book-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-book"> <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path> </svg> </template> <template id="code-review-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code-review"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 13H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25v-8.5C0 1.784.784 1 1.75 1ZM1.5 2.75v8.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm5.28 1.72a.75.75 0 0 1 0 1.06L5.31 7l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.75.75 0 0 1 1.06 0Zm2.44 0a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L10.69 7 9.22 5.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </template> <template id="codespaces-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-codespaces"> <path d="M0 11.25c0-.966.784-1.75 1.75-1.75h12.5c.966 0 1.75.784 1.75 1.75v3A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm2-9.5C2 .784 2.784 0 3.75 0h8.5C13.216 0 14 .784 14 1.75v5a1.75 1.75 0 0 1-1.75 1.75h-8.5A1.75 1.75 0 0 1 2 6.75Zm1.75-.25a.25.25 0 0 0-.25.25v5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5a.25.25 0 0 0-.25-.25Zm-2 9.5a.25.25 0 0 0-.25.25v3c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-3a.25.25 0 0 0-.25-.25Z"></path><path d="M7 12.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path> </svg> </template> <template id="comment-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment"> <path d="M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="comment-discussion-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment-discussion"> <path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path> </svg> </template> <template id="organization-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-organization"> <path d="M1.75 16A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0h8.5C11.216 0 12 .784 12 1.75v12.5c0 .085-.006.168-.018.25h2.268a.25.25 0 0 0 .25-.25V8.285a.25.25 0 0 0-.111-.208l-1.055-.703a.749.749 0 1 1 .832-1.248l1.055.703c.487.325.779.871.779 1.456v5.965A1.75 1.75 0 0 1 14.25 16h-3.5a.766.766 0 0 1-.197-.026c-.099.017-.2.026-.303.026h-3a.75.75 0 0 1-.75-.75V14h-1v1.25a.75.75 0 0 1-.75.75Zm-.25-1.75c0 .138.112.25.25.25H4v-1.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 .75.75v1.25h2.25a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25ZM3.75 6h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5ZM3 3.75A.75.75 0 0 1 3.75 3h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 3.75Zm4 3A.75.75 0 0 1 7.75 6h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 7 6.75ZM7.75 3h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5ZM3 9.75A.75.75 0 0 1 3.75 9h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 9.75ZM7.75 9h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5Z"></path> </svg> </template> <template id="rocket-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-rocket"> <path d="M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </template> <template id="shield-check-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield-check"> <path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </template> <template id="heart-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-heart"> <path d="m8 14.25.345.666a.75.75 0 0 1-.69 0l-.008-.004-.018-.01a7.152 7.152 0 0 1-.31-.17 22.055 22.055 0 0 1-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.066 22.066 0 0 1-3.744 2.584l-.018.01-.006.003h-.002ZM4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.58 20.58 0 0 0 8 13.393a20.58 20.58 0 0 0 3.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.749.749 0 0 1-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5Z"></path> </svg> </template> <template id="server-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-server"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v4c0 .372-.116.717-.314 1 .198.283.314.628.314 1v4a1.75 1.75 0 0 1-1.75 1.75H1.75A1.75 1.75 0 0 1 0 12.75v-4c0-.358.109-.707.314-1a1.739 1.739 0 0 1-.314-1v-4C0 1.784.784 1 1.75 1ZM1.5 2.75v4c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm.25 5.75a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25ZM7 4.75A.75.75 0 0 1 7.75 4h4.5a.75.75 0 0 1 0 1.5h-4.5A.75.75 0 0 1 7 4.75ZM7.75 10h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM3 4.75A.75.75 0 0 1 3.75 4h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 4.75ZM3.75 10h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5Z"></path> </svg> </template> <template id="globe-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-globe"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM5.78 8.75a9.64 9.64 0 0 0 1.363 4.177c.255.426.542.832.857 1.215.245-.296.551-.705.857-1.215A9.64 9.64 0 0 0 10.22 8.75Zm4.44-1.5a9.64 9.64 0 0 0-1.363-4.177c-.307-.51-.612-.919-.857-1.215a9.927 9.927 0 0 0-.857 1.215A9.64 9.64 0 0 0 5.78 7.25Zm-5.944 1.5H1.543a6.507 6.507 0 0 0 4.666 5.5c-.123-.181-.24-.365-.352-.552-.715-1.192-1.437-2.874-1.581-4.948Zm-2.733-1.5h2.733c.144-2.074.866-3.756 1.58-4.948.12-.197.237-.381.353-.552a6.507 6.507 0 0 0-4.666 5.5Zm10.181 1.5c-.144 2.074-.866 3.756-1.58 4.948-.12.197-.237.381-.353.552a6.507 6.507 0 0 0 4.666-5.5Zm2.733-1.5a6.507 6.507 0 0 0-4.666-5.5c.123.181.24.365.353.552.714 1.192 1.436 2.874 1.58 4.948Z"></path> </svg> </template> <template id="issue-opened-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> </template> <template id="device-mobile-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-mobile"> <path d="M3.75 0h8.5C13.216 0 14 .784 14 1.75v12.5A1.75 1.75 0 0 1 12.25 16h-8.5A1.75 1.75 0 0 1 2 14.25V1.75C2 .784 2.784 0 3.75 0ZM3.5 1.75v12.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25ZM8 13a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path> </svg> </template> <template id="package-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-package"> <path d="m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"></path> </svg> </template> <template id="credit-card-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-credit-card"> <path d="M10.75 9a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5h-1.5Z"></path><path d="M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25ZM14.5 6.5h-13v5.75c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25Zm0-2.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25V5h13Z"></path> </svg> </template> <template id="play-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> </template> <template id="gift-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-gift"> <path d="M2 2.75A2.75 2.75 0 0 1 4.75 0c.983 0 1.873.42 2.57 1.232.268.318.497.668.68 1.042.183-.375.411-.725.68-1.044C9.376.42 10.266 0 11.25 0a2.75 2.75 0 0 1 2.45 4h.55c.966 0 1.75.784 1.75 1.75v2c0 .698-.409 1.301-1 1.582v4.918A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25V9.332C.409 9.05 0 8.448 0 7.75v-2C0 4.784.784 4 1.75 4h.55c-.192-.375-.3-.8-.3-1.25ZM7.25 9.5H2.5v4.75c0 .138.112.25.25.25h4.5Zm1.5 0v5h4.5a.25.25 0 0 0 .25-.25V9.5Zm0-4V8h5.5a.25.25 0 0 0 .25-.25v-2a.25.25 0 0 0-.25-.25Zm-7 0a.25.25 0 0 0-.25.25v2c0 .138.112.25.25.25h5.5V5.5h-5.5Zm3-4a1.25 1.25 0 0 0 0 2.5h2.309c-.233-.818-.542-1.401-.878-1.793-.43-.502-.915-.707-1.431-.707ZM8.941 4h2.309a1.25 1.25 0 0 0 0-2.5c-.516 0-1 .205-1.43.707-.337.392-.646.975-.879 1.793Z"></path> </svg> </template> <template id="code-square-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code-square"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </template> <template id="device-desktop-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-desktop"> <path d="M14.25 1c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 14.25 12h-3.727c.099 1.041.52 1.872 1.292 2.757A.752.752 0 0 1 11.25 16h-6.5a.75.75 0 0 1-.565-1.243c.772-.885 1.192-1.716 1.292-2.757H1.75A1.75 1.75 0 0 1 0 10.25v-7.5C0 1.784.784 1 1.75 1ZM1.75 2.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25ZM9.018 12H6.982a5.72 5.72 0 0 1-.765 2.5h3.566a5.72 5.72 0 0 1-.765-2.5Z"></path> </svg> </template> <div class="position-relative"> <ul role="listbox" class="ActionListWrap QueryBuilder-ListWrap" aria-label="Suggestions" data-action=" combobox-commit:query-builder#comboboxCommit mousedown:query-builder#resultsMousedown " data-target="query-builder.resultsList" data-persist-list=false id="query-builder-test-results" ></ul> </div> <div class="FormControl-inlineValidation" id="validation-df9c70ea-14ea-4a34-a4fa-38a1513abdad" hidden="hidden"> <span class="FormControl-inlineValidation--visual"> <svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-alert-fill"> <path d="M4.855.708c.5-.896 1.79-.896 2.29 0l4.675 8.351a1.312 1.312 0 0 1-1.146 1.954H1.33A1.313 1.313 0 0 1 .183 9.058ZM7 7V3H5v4Zm-1 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path> </svg> </span> <span></span> </div> </div> <div data-target="query-builder.screenReaderFeedback" aria-live="polite" aria-atomic="true" class="sr-only"></div> </query-builder></form> <div class="d-flex flex-row color-fg-muted px-3 text-small color-bg-default search-feedback-prompt"> <a target="_blank" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax" data-view-component="true" class="Link color-fg-accent text-normal ml-2">Search syntax tips</a> <div class="d-flex flex-1"></div> </div> </div> </div> </div> </modal-dialog></div> </div> <div data-action="click:qbsearch-input#retract" class="dark-backdrop position-fixed" hidden data-target="qbsearch-input.darkBackdrop"></div> <div class="color-fg-default"> <dialog-helper> <dialog data-target="qbsearch-input.feedbackDialog" data-action="close:qbsearch-input#handleDialogClose cancel:qbsearch-input#handleDialogClose" id="feedback-dialog" aria-modal="true" aria-labelledby="feedback-dialog-title" aria-describedby="feedback-dialog-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--disableScroll"> <div data-view-component="true" class="Overlay-header"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 class="Overlay-title " id="feedback-dialog-title"> Provide feedback </h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="feedback-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg></button> </div> </div> </div> <scrollable-region data-labelled-by="feedback-dialog-title"> <div data-view-component="true" class="Overlay-body"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="code-search-feedback-form" data-turbo="false" action="/search/feedback" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="IZLNSOqv2XuR1N1Gs1YL6Rq4OhtYxLkwUuj5lHf/WBHiAm2MdiJFI1KIN9kAdQjpbr0ReiIjUCojAdgwWGYemw==" /> <p>We read every piece of feedback, and take your input very seriously.</p> <textarea name="feedback" class="form-control width-full mb-2" style="height: 120px" id="feedback"></textarea> <input name="include_email" id="include_email" aria-label="Include my email address so I can be contacted" class="form-control mr-2" type="checkbox"> <label for="include_email" style="font-weight: normal">Include my email address so I can be contacted</label> </form></div> </scrollable-region> <div data-view-component="true" class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="feedback-dialog" type="button" data-view-component="true" class="btn"> Cancel </button> <button form="code-search-feedback-form" data-action="click:qbsearch-input#submitFeedback" type="submit" data-view-component="true" class="btn-primary btn"> Submit feedback </button> </div> </dialog></dialog-helper> <custom-scopes data-target="qbsearch-input.customScopesManager"> <dialog-helper> <dialog data-target="custom-scopes.customScopesModalDialog" data-action="close:qbsearch-input#handleDialogClose cancel:qbsearch-input#handleDialogClose" id="custom-scopes-dialog" aria-modal="true" aria-labelledby="custom-scopes-dialog-title" aria-describedby="custom-scopes-dialog-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--disableScroll"> <div data-view-component="true" class="Overlay-header Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 class="Overlay-title " id="custom-scopes-dialog-title"> Saved searches </h1> <h2 id="custom-scopes-dialog-description" class="Overlay-description">Use saved searches to filter your results more quickly</h2> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="custom-scopes-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg></button> </div> </div> </div> <scrollable-region data-labelled-by="custom-scopes-dialog-title"> <div data-view-component="true" class="Overlay-body"> <div data-target="custom-scopes.customScopesModalDialogFlash"></div> <div hidden class="create-custom-scope-form" data-target="custom-scopes.createCustomScopeForm"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="custom-scopes-dialog-form" data-turbo="false" action="/search/custom_scopes" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="5N8LnnhPZvjnJNCKh3H4celaOdmsNAJQ6/1eMoAIPzCjhF/alKo/2Km/kv6Sv0Jmw000vU/+HwOZIhO1sevfQA==" /> <div data-target="custom-scopes.customScopesModalDialogFlash"></div> <input type="hidden" id="custom_scope_id" name="custom_scope_id" data-target="custom-scopes.customScopesIdField"> <div class="form-group"> <label for="custom_scope_name">Name</label> <auto-check src="/search/custom_scopes/check_name" required only-validate-on-blur="false"> <input type="text" name="custom_scope_name" id="custom_scope_name" data-target="custom-scopes.customScopesNameField" class="form-control" autocomplete="off" placeholder="github-ruby" required maxlength="50"> <input type="hidden" data-csrf="true" value="0Kv2pXFi295ZE3zEt/Gkv1uZVgnDElmvCotgndLuBD3upeM4NKqXRltOUs9j4i3CHvBTZ0K4K7TjTkkg/ltd+Q==" /> </auto-check> </div> <div class="form-group"> <label for="custom_scope_query">Query</label> <input type="text" name="custom_scope_query" id="custom_scope_query" data-target="custom-scopes.customScopesQueryField" class="form-control" autocomplete="off" placeholder="(repo:mona/a OR repo:mona/b) AND lang:python" required maxlength="500"> </div> <p class="text-small color-fg-muted"> To see all available qualifiers, see our <a class="Link--inTextBlock" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax">documentation</a>. </p> </form> </div> <div data-target="custom-scopes.manageCustomScopesForm"> <div data-target="custom-scopes.list"></div> </div> </div> </scrollable-region> <div data-view-component="true" class="Overlay-footer Overlay-footer--alignEnd Overlay-footer--divided"> <button data-action="click:custom-scopes#customScopesCancel" type="button" data-view-component="true" class="btn"> Cancel </button> <button form="custom-scopes-dialog-form" data-action="click:custom-scopes#customScopesSubmit" data-target="custom-scopes.customScopesSubmitButton" type="submit" data-view-component="true" class="btn-primary btn"> Create saved search </button> </div> </dialog></dialog-helper> </custom-scopes> </div> </qbsearch-input> <div class="position-relative HeaderMenu-link-wrap d-lg-inline-block"> <a href="/login?return_to=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen" class="HeaderMenu-link HeaderMenu-link--sign-in HeaderMenu-button flex-shrink-0 no-underline d-none d-lg-inline-flex border border-lg-0 rounded rounded-lg-0 px-2 py-1" style="margin-left: 12px;" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="604069e8d7875177589400da3d5c6c6f8cc1db1475227b59ea4dfa1671c50232" data-analytics-event="{"category":"Marketing nav","action":"click to go to homepage","label":"ref_page:Marketing;ref_cta:Sign in;ref_loc:Header"}" > Sign in </a> </div> <a href="/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&source=header-repo&source_repo=QwenLM%2FQwen" class="HeaderMenu-link HeaderMenu-link--sign-up HeaderMenu-button flex-shrink-0 d-flex d-lg-inline-flex no-underline border color-border-default rounded px-2 py-1" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="604069e8d7875177589400da3d5c6c6f8cc1db1475227b59ea4dfa1671c50232" data-analytics-event="{"category":"Sign up","action":"click to sign up for account","label":"ref_page:/<user-name>/<repo-name>;ref_cta:Sign up;ref_loc:header logged out"}" > Sign up </a> <button type="button" class="sr-only js-header-menu-focus-trap d-block d-lg-none">Reseting focus</button> </div> </div> </div> </div> </header> <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <span class="js-stale-session-flash-signed-in" hidden>You signed in with another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <span class="js-stale-session-flash-signed-out" hidden>You signed out in another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <span class="js-stale-session-flash-switched" hidden>You switched accounts on another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <button id="icon-button-094671b4-2ca3-48d2-8fc7-4a07689899ad" aria-labelledby="tooltip-84e6bdaa-f0a5-40d2-8f30-abd2b906d710" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button><tool-tip id="tooltip-84e6bdaa-f0a5-40d2-8f30-abd2b906d710" for="icon-button-094671b4-2ca3-48d2-8fc7-4a07689899ad" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Dismiss alert</tool-tip> </div> </div> <div id="start-of-content" class="show-on-focus"></div> <div id="js-flash-container" class="flash-container" data-turbo-replace> <template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div> </div> </div> </div> </template> </div> <div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled data-project-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" > <div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--page-header-bgColor, var(--color-page-header-bg));" data-turbo-replace> <div class="d-flex flex-nowrap flex-justify-end mb-3 px-3 px-lg-5" style="gap: 1rem;"> <div class="flex-auto min-width-0 width-fit"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path> </svg> <span class="author flex-self-stretch" itemprop="author"> <a class="url fn" rel="author" data-hovercard-type="organization" data-hovercard-url="/orgs/QwenLM/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/QwenLM"> QwenLM </a> </span> <span class="mx-1 flex-self-stretch color-fg-muted">/</span> <strong itemprop="name" class="mr-2 flex-self-stretch"> <a data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" href="/QwenLM/Qwen">Qwen</a> </strong> <span></span><span class="Label Label--secondary v-align-middle mr-1">Public</span> </div> </div> <div id="repository-details-container" class="flex-shrink-0" data-turbo-replace style="max-width: 70%;"> <ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;"> <li> <a href="/login?return_to=%2FQwenLM%2FQwen" rel="nofollow" id="repository-details-watch-button" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"notification subscription menu watch","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="696eb0e1174623e27c445d9a586d5b339fa03bdc9ff05a72d7fb0d96690c72f7" aria-label="You must be signed in to change notification settings" data-view-component="true" class="btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path> </svg>Notifications </a> <tool-tip id="tooltip-bed8bbec-c520-452d-a946-60d5b35fa536" for="repository-details-watch-button" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">You must be signed in to change notification settings</tool-tip> </li> <li> <a icon="repo-forked" id="fork-button" href="/login?return_to=%2FQwenLM%2FQwen" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"repo details fork button","repository_id":674075444,"auth_type":"LOG_IN","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="3b2371a73b0bc5587bd52e24999900b538b25e89e745bc0d90eb6d187dd77204" data-view-component="true" class="btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path> </svg>Fork <span id="repo-network-counter" data-pjax-replace="true" data-turbo-replace="true" title="1,398" data-view-component="true" class="Counter">1.4k</span> </a> </li> <li> <div data-view-component="true" class="BtnGroup d-flex"> <a href="/login?return_to=%2FQwenLM%2FQwen" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"star button","repository_id":674075444,"auth_type":"LOG_IN","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="e80285957e121b10249604e07a6a1e3ea3bebcd0655e9ac096a2e8c36084fb45" aria-label="You must be signed in to star a repository" data-view-component="true" class="tooltipped tooltipped-sw btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path> </svg><span data-view-component="true" class="d-inline"> Star </span> <span id="repo-stars-counter-star" aria-label="16906 users starred this repository" data-singular-suffix="user starred this repository" data-plural-suffix="users starred this repository" data-turbo-replace="true" title="16,906" data-view-component="true" class="Counter js-social-count">16.9k</span> </a></div> </li> </ul> </div> </div> <div id="responsive-meta-container" data-turbo-replace> <div class="d-block d-md-none mb-2 px-3 px-md-4 px-lg-5"> <p class="f4 mb-3 "> The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. </p> <h3 class="sr-only">License</h3> <div class="mb-2"> <a href="/QwenLM/Qwen/blob/main/LICENSE" class="Link--muted" data-analytics-event="{"category":"Repository Overview","action":"click","label":"location:sidebar;file:license"}" > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-law mr-2"> <path d="M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z"></path> </svg> Apache-2.0 license </a> </div> <div class="mb-3"> <a class="Link--secondary no-underline mr-3" href="/QwenLM/Qwen/stargazers"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star mr-1"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path> </svg> <span class="text-bold">16.9k</span> stars </a> <a class="Link--secondary no-underline mr-3" href="/QwenLM/Qwen/forks"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-1"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path> </svg> <span class="text-bold">1.4k</span> forks </a> <a class="Link--secondary no-underline mr-3 d-inline-block" href="/QwenLM/Qwen/branches"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch mr-1"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path> </svg> <span>Branches</span> </a> <a class="Link--secondary no-underline d-inline-block" href="/QwenLM/Qwen/tags"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-tag mr-1"> <path d="M1 7.775V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.752 1.752 0 0 1 1 7.775Zm1.5 0c0 .066.026.13.073.177l6.25 6.25a.25.25 0 0 0 .354 0l5.025-5.025a.25.25 0 0 0 0-.354l-6.25-6.25a.25.25 0 0 0-.177-.073H2.75a.25.25 0 0 0-.25.25ZM6 5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"></path> </svg> <span>Tags</span> </a> <a class="Link--secondary no-underline d-inline-block" href="/QwenLM/Qwen/activity"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-pulse mr-1"> <path d="M6 2c.306 0 .582.187.696.471L10 10.731l1.304-3.26A.751.751 0 0 1 12 7h3.25a.75.75 0 0 1 0 1.5h-2.742l-1.812 4.528a.751.751 0 0 1-1.392 0L6 4.77 4.696 8.03A.75.75 0 0 1 4 8.5H.75a.75.75 0 0 1 0-1.5h2.742l1.812-4.529A.751.751 0 0 1 6 2Z"></path> </svg> <span>Activity</span> </a> </div> <div class="d-flex flex-wrap gap-2"> <div class="flex-1"> <div data-view-component="true" class="BtnGroup d-flex"> <a href="/login?return_to=%2FQwenLM%2FQwen" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"star button","repository_id":674075444,"auth_type":"LOG_IN","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="e80285957e121b10249604e07a6a1e3ea3bebcd0655e9ac096a2e8c36084fb45" aria-label="You must be signed in to star a repository" data-view-component="true" class="tooltipped tooltipped-sw btn-sm btn btn-block"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path> </svg><span data-view-component="true" class="d-inline"> Star </span> </a></div> </div> <div class="flex-1"> <a href="/login?return_to=%2FQwenLM%2FQwen" rel="nofollow" id="files-overview-watch-button" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"notification subscription menu watch","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://github.com/QwenLM/Qwen","user_id":null}}" data-hydro-click-hmac="696eb0e1174623e27c445d9a586d5b339fa03bdc9ff05a72d7fb0d96690c72f7" aria-label="You must be signed in to change notification settings" data-view-component="true" class="btn-sm btn btn-block"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path> </svg>Notifications </a> <tool-tip id="tooltip-86728690-3022-4c76-a4cb-2a474e901509" for="files-overview-watch-button" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">You must be signed in to change notification settings</tool-tip> </div> <span> </span> </div> </div> </div> <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5"> <ul data-view-component="true" class="UnderlineNav-body list-style-none"> <li data-view-component="true" class="d-inline-flex"> <a id="code-tab" href="/QwenLM/Qwen" data-tab-item="i0code-tab" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages repo_deployments repo_attestations /QwenLM/Qwen" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g c" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Code","target":"UNDERLINE_NAV.TAB"}" aria-current="page" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item selected"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> <span data-content="Code">Code</span> <span id="code-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="issues-tab" href="/QwenLM/Qwen/issues" data-tab-item="i1issues-tab" data-selected-links="repo_issues repo_labels repo_milestones /QwenLM/Qwen/issues" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g i" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Issues","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> <span data-content="Issues">Issues</span> <span id="issues-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="11" data-view-component="true" class="Counter">11</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="pull-requests-tab" href="/QwenLM/Qwen/pulls" data-tab-item="i2pull-requests-tab" data-selected-links="repo_pulls checks /QwenLM/Qwen/pulls" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g p" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Pull requests","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path> </svg> <span data-content="Pull requests">Pull requests</span> <span id="pull-requests-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="13" data-view-component="true" class="Counter">13</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="discussions-tab" href="/QwenLM/Qwen/discussions" data-tab-item="i3discussions-tab" data-selected-links="repo_discussions /QwenLM/Qwen/discussions" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g g" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Discussions","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment-discussion UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path> </svg> <span data-content="Discussions">Discussions</span> <span id="discussions-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="actions-tab" href="/QwenLM/Qwen/actions" data-tab-item="i4actions-tab" data-selected-links="repo_actions /QwenLM/Qwen/actions" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g a" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Actions","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> <span data-content="Actions">Actions</span> <span id="actions-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="projects-tab" href="/QwenLM/Qwen/projects" data-tab-item="i5projects-tab" data-selected-links="repo_projects new_repo_project repo_project /QwenLM/Qwen/projects" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g b" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Projects","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path> </svg> <span data-content="Projects">Projects</span> <span id="projects-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="0" hidden="hidden" data-view-component="true" class="Counter">0</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="security-tab" href="/QwenLM/Qwen/security" data-tab-item="i6security-tab" data-selected-links="security overview alerts policy token_scanning code_scanning /QwenLM/Qwen/security" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g s" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Security","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <span data-content="Security">Security</span> <include-fragment src="/QwenLM/Qwen/security/overall-count" accept="text/fragment+html"></include-fragment> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="insights-tab" href="/QwenLM/Qwen/pulse" data-tab-item="i7insights-tab" data-selected-links="repo_graphs repo_contributors dependency_graph dependabot_updates pulse people community /QwenLM/Qwen/pulse" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Insights","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> <span data-content="Insights">Insights</span> <span id="insights-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> </ul> <div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <action-menu data-select-variant="none" data-view-component="true"> <focus-group direction="vertical" mnemonics retain> <button id="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-button" popovertarget="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-overlay" aria-controls="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-list" aria-haspopup="true" aria-labelledby="tooltip-2fbc6e87-be96-48bc-abd4-fbcab3461691" type="button" data-view-component="true" class="Button Button--iconOnly Button--secondary Button--medium UnderlineNav-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal Button-visual"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path> </svg> </button><tool-tip id="tooltip-2fbc6e87-be96-48bc-abd4-fbcab3461691" for="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-button" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Additional navigation options</tool-tip> <anchored-position data-target="action-menu.overlay" id="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-overlay" anchor="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-button" align="start" side="outside-bottom" anchor-offset="normal" popover="auto" data-view-component="true"> <div data-view-component="true" class="Overlay Overlay--size-auto"> <div data-view-component="true" class="Overlay-body Overlay-body--paddingNone"> <action-list> <div data-view-component="true"> <ul aria-labelledby="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-button" id="action-menu-8b5bb8bf-6935-4aab-a223-f0abaa5e704e-list" role="menu" data-view-component="true" class="ActionListWrap--inset ActionListWrap"> <li hidden="hidden" data-menu-item="i0code-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-8c01736f-140b-4606-8835-12fde4a649e2" href="/QwenLM/Qwen" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Code </span> </a> </li> <li hidden="hidden" data-menu-item="i1issues-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-187f484c-f171-4c1c-8566-8431f897d6e2" href="/QwenLM/Qwen/issues" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Issues </span> </a> </li> <li hidden="hidden" data-menu-item="i2pull-requests-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-730fcf88-f5d7-49f3-9cbe-8d810d2346ab" href="/QwenLM/Qwen/pulls" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Pull requests </span> </a> </li> <li hidden="hidden" data-menu-item="i3discussions-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-86d94a8e-7d12-4ec2-9b69-cbba718d8758" href="/QwenLM/Qwen/discussions" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment-discussion"> <path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Discussions </span> </a> </li> <li hidden="hidden" data-menu-item="i4actions-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-fd54a685-5529-4729-920d-6711017ee79f" href="/QwenLM/Qwen/actions" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Actions </span> </a> </li> <li hidden="hidden" data-menu-item="i5projects-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-8690352e-c944-4114-9147-89d3182f7441" href="/QwenLM/Qwen/projects" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Projects </span> </a> </li> <li hidden="hidden" data-menu-item="i6security-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-8d98dcff-a828-491f-acd5-798c28b29306" href="/QwenLM/Qwen/security" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Security </span> </a> </li> <li hidden="hidden" data-menu-item="i7insights-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-678dbf28-a647-4779-b9be-3f02e75551d9" href="/QwenLM/Qwen/pulse" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Insights </span> </a> </li> </ul> </div></action-list> </div> </div></anchored-position> </focus-group> </action-menu></div> </nav> </div> <turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " > <h1 class='sr-only'>QwenLM/Qwen</h1> <div class="clearfix container-xl px-md-4 px-lg-5 px-3"> <div> <div style="max-width: 100%" data-view-component="true" class="Layout Layout--flowRow-until-md react-repos-overview-margin Layout--sidebarPosition-end Layout--sidebarPosition-flowRow-end"> <div data-view-component="true" class="Layout-main"> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_dompurify_dist_purify_js-b89b98661809.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_tanstack_query-core_build_modern_queryObserver_js-node_modules_tanstack_-defd52-843b41414e0e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_hydro-analytics-client_dist_analytics-client_js-node_modules_gith-853b24-f2006d2a5b98.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_aria-live_aria-live_ts-ui_packages_promise-with-resolvers-polyfill_promise-with-r-17c672-d6b5ea82572a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_paths_index_ts-9c4436ef49de.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_ref-selector_RefSelector_tsx-2cce17df147b.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_code-view-shared_hooks_use-canonical-object_ts-ui_packages_code-view-shared_hooks-a6859a-09c7f754ea79.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repos-overview-d88ea0b31285.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.5a0ffaf77c0db0d0dac2.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repos-overview.32a87dc4587d56dcf1eb.module.css" /> <react-partial partial-name="repos-overview" data-ssr="true" data-attempted-ssr="true" > <script type="application/json" data-target="react-partial.embeddedData">{"props":{"initialPayload":{"allShortcutsEnabled":false,"path":"/","repo":{"id":674075444,"defaultBranch":"main","name":"Qwen","ownerLogin":"QwenLM","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-08-03T04:56:38.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/141221163?v=4","public":true,"private":false,"isOrgOwned":true},"currentUser":null,"refInfo":{"name":"main","listCacheKey":"v0:1718872741.0","canEdit":false,"refType":"branch","currentOid":"83d715b4ef6d8a22755ccf62ae9b5d6b146f9dd6"},"tree":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"ascend-support","path":"ascend-support","contentType":"directory"},{"name":"assets","path":"assets","contentType":"directory"},{"name":"dcu-support","path":"dcu-support","contentType":"directory"},{"name":"docker","path":"docker","contentType":"directory"},{"name":"eval","path":"eval","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"finetune","path":"finetune","contentType":"directory"},{"name":"recipes","path":"recipes","contentType":"directory"},{"name":".dockerignore","path":".dockerignore","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"FAQ.md","path":"FAQ.md","contentType":"file"},{"name":"FAQ_ja.md","path":"FAQ_ja.md","contentType":"file"},{"name":"FAQ_zh.md","path":"FAQ_zh.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"NOTICE","path":"NOTICE","contentType":"file"},{"name":"QWEN_TECHNICAL_REPORT.pdf","path":"QWEN_TECHNICAL_REPORT.pdf","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"README_CN.md","path":"README_CN.md","contentType":"file"},{"name":"README_ES.md","path":"README_ES.md","contentType":"file"},{"name":"README_FR.md","path":"README_FR.md","contentType":"file"},{"name":"README_JA.md","path":"README_JA.md","contentType":"file"},{"name":"Tongyi Qianwen LICENSE AGREEMENT","path":"Tongyi Qianwen LICENSE AGREEMENT","contentType":"file"},{"name":"Tongyi Qianwen RESEARCH LICENSE AGREEMENT","path":"Tongyi Qianwen RESEARCH LICENSE AGREEMENT","contentType":"file"},{"name":"cli_demo.py","path":"cli_demo.py","contentType":"file"},{"name":"finetune.py","path":"finetune.py","contentType":"file"},{"name":"openai_api.py","path":"openai_api.py","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"},{"name":"requirements_web_demo.txt","path":"requirements_web_demo.txt","contentType":"file"},{"name":"run_gptq.py","path":"run_gptq.py","contentType":"file"},{"name":"tech_memo.md","path":"tech_memo.md","contentType":"file"},{"name":"tokenization_note.md","path":"tokenization_note.md","contentType":"file"},{"name":"tokenization_note_ja.md","path":"tokenization_note_ja.md","contentType":"file"},{"name":"tokenization_note_zh.md","path":"tokenization_note_zh.md","contentType":"file"},{"name":"utils.py","path":"utils.py","contentType":"file"},{"name":"web_demo.py","path":"web_demo.py","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":null,"totalCount":36,"showBranchInfobar":false},"fileTree":null,"fileTreeProcessingTime":null,"foldersToFetch":[],"treeExpanded":false,"symbolsExpanded":false,"isOverview":true,"overview":{"banners":{"shouldRecommendReadme":false,"isPersonalRepo":false,"showUseActionBanner":false,"actionSlug":null,"actionId":null,"showProtectBranchBanner":false,"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_repo","releasePath":"/QwenLM/Qwen/releases/new?marketplace=true","showPublishActionBanner":false},"interactionLimitBanner":null,"showInvitationBanner":false,"inviterName":null,"actionsMigrationBannerInfo":{"releaseTags":[],"showImmutableActionsMigrationBanner":false,"initialMigrationStatus":null}},"codeButton":{"contactPath":"/contact","isEnterprise":false,"local":{"protocolInfo":{"httpAvailable":true,"sshAvailable":null,"httpUrl":"https://github.com/QwenLM/Qwen.git","showCloneWarning":null,"sshUrl":null,"sshCertificatesRequired":null,"sshCertificatesAvailable":null,"ghCliUrl":"gh repo clone QwenLM/Qwen","defaultProtocol":"http","newSshKeyUrl":"/settings/ssh/new","setProtocolPath":"/users/set_protocol"},"platformInfo":{"cloneUrl":"https://desktop.github.com","showVisualStudioCloneButton":false,"visualStudioCloneUrl":"https://windows.github.com","showXcodeCloneButton":false,"xcodeCloneUrl":"xcode://clone?repo=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen","zipballUrl":"/QwenLM/Qwen/archive/refs/heads/main.zip"}},"newCodespacePath":"/codespaces/new?hide_repo_select=true\u0026repo=674075444"},"popovers":{"rename":null,"renamedParentRepo":null},"commitCount":"501","overviewFiles":[{"displayName":"README.md","repoName":"Qwen","refName":"main","path":"README.md","preferredFileType":"readme","tabName":"README","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cp align=\"left\" dir=\"auto\"\u003e\n \u003ca href=\"/QwenLM/Qwen/blob/main/README_CN.md\"\u003e中文\u003c/a\u003e | English | \u003ca href=\"/QwenLM/Qwen/blob/main/README_JA.md\"\u003e日本語\u003c/a\u003e | \u003ca href=\"/QwenLM/Qwen/blob/main/README_FR.md\"\u003eFrançais\u003c/a\u003e | \u003ca href=\"/QwenLM/Qwen/blob/main/README_ES.md\"\u003eEspañol\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/9b22e1232168606b1f0a237a93d447f3f06187caa8b6f036556f71050846bc86/68747470733a2f2f7169616e77656e2d7265732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6c6f676f5f7177656e2e6a7067\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/9b22e1232168606b1f0a237a93d447f3f06187caa8b6f036556f71050846bc86/68747470733a2f2f7169616e77656e2d7265732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6c6f676f5f7177656e2e6a7067\" width=\"400\" data-canonical-src=\"https://qianwen-res.oss-cn-beijing.aliyuncs.com/logo_qwen.jpg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003cbr\u003e\n\u003c/p\u003e\u003cp align=\"center\" dir=\"auto\"\u003e\n 🤗 \u003ca href=\"https://huggingface.co/Qwen\" rel=\"nofollow\"\u003eHugging Face\u003c/a\u003e | 🤖 \u003ca href=\"https://modelscope.cn/organization/qwen\" rel=\"nofollow\"\u003eModelScope\u003c/a\u003e | 📑 \u003ca href=\"https://arxiv.org/abs/2309.16609\" rel=\"nofollow\"\u003ePaper\u003c/a\u003e | 🖥️ \u003ca href=\"https://modelscope.cn/studios/qwen/Qwen-72B-Chat-Demo/summary\" rel=\"nofollow\"\u003eDemo\u003c/a\u003e\n\u003cbr\u003e\n\u003ca href=\"/QwenLM/Qwen/blob/main/assets/wechat.png\"\u003eWeChat (微信)\u003c/a\u003e | \u003ca href=\"https://discord.gg/CV4E9rpNSD\" rel=\"nofollow\"\u003eDiscord\u003c/a\u003e | \u003ca href=\"https://dashscope.aliyun.com\" rel=\"nofollow\"\u003eAPI\u003c/a\u003e \n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cdiv class=\"markdown-alert markdown-alert-important\" dir=\"auto\"\u003e\u003cp class=\"markdown-alert-title\" dir=\"auto\"\u003e\u003csvg class=\"octicon octicon-report mr-2\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"\u003e\u003c/path\u003e\u003c/svg\u003eImportant\u003c/p\u003e\u003cp dir=\"auto\"\u003eQwen2 is here! You are welcome to follow \u003ca href=\"https://github.com/QwenLM/Qwen2\"\u003eQwenLM/Qwen2\u003c/a\u003e and share your experience there.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis repo (\u003ca href=\"https://github.com/QwenLM/Qwen\"\u003eQwenLM/Qwen\u003c/a\u003e) is no longer actively maintained, due to substantial codebase differences.\u003c/p\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e\u003c/th\u003e\n\u003cth align=\"center\"\u003eQwen-Chat\u003c/th\u003e\n\u003cth align=\"center\"\u003eQwen-Chat (Int4)\u003c/th\u003e\n\u003cth align=\"center\"\u003eQwen-Chat (Int8)\u003c/th\u003e\n\u003cth align=\"center\"\u003eQwen\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e1.8B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-1_8B-Chat/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-1_8B-Chat\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-1_8B-Chat-Int4/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-1_8B-Chat-Int4\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-1_8B-Chat-Int8/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-1_8B-Chat-Int8\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-1_8B/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-1_8B\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e7B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-7B-Chat/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-7B-Chat\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-7B-Chat-Int4/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-7B-Chat-Int4\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-7B-Chat-Int8/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-7B-Chat-Int8\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-7B/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-7B\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e14B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-14B-Chat/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-14B-Chat\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-14B-Chat-Int4/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-14B-Chat-Int4\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-14B-Chat-Int8/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-14B-Chat-Int8\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-14B/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-14B\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e72B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-72B-Chat/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-72B-Chat\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-72B-Chat-Int4/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-72B-Chat-Int4\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-72B-Chat-Int8/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-72B-Chat-Int8\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://modelscope.cn/models/qwen/Qwen-72B/summary\" rel=\"nofollow\"\u003e🤖\u003c/a\u003e \u003ca href=\"https://huggingface.co/Qwen/Qwen-72B\" rel=\"nofollow\"\u003e🤗\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eWe opensource our \u003cstrong\u003eQwen\u003c/strong\u003e series, now including \u003cstrong\u003eQwen\u003c/strong\u003e, the base language models, namely \u003cstrong\u003eQwen-1.8B\u003c/strong\u003e, \u003cstrong\u003eQwen-7B\u003c/strong\u003e, \u003cstrong\u003eQwen-14B\u003c/strong\u003e, and \u003cstrong\u003eQwen-72B\u003c/strong\u003e, as well as \u003cstrong\u003eQwen-Chat\u003c/strong\u003e, the chat models, namely \u003cstrong\u003eQwen-1.8B-Chat\u003c/strong\u003e, \u003cstrong\u003eQwen-7B-Chat\u003c/strong\u003e, \u003cstrong\u003eQwen-14B-Chat\u003c/strong\u003e, and \u003cstrong\u003eQwen-72B-Chat\u003c/strong\u003e. Links are on the above table. Click them and check the model cards. Also, we release the \u003cstrong\u003e\u003ca href=\"https://arxiv.org/abs/2309.16609\" rel=\"nofollow\"\u003etechnical report\u003c/a\u003e\u003c/strong\u003e. Please click the paper link and check it out!\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIn brief, we have strong base language models, which have been stably pretrained for up to 3 trillion tokens of multilingual data with a wide coverage of domains, languages (with a focus on Chinese and English), etc. They are able to achieve competitive performance on benchmark datasets. Additionally, we have chat models that are aligned with human preference based on SFT and RLHF (not released yet), which are able to chat, create content, extract information, summarize, translate, code, solve math problems, and so on, and are able to use tools, play as agents, or even play as code interpreters, etc.\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth align=\"left\"\u003eModel\u003c/th\u003e\n\u003cth align=\"center\"\u003eRelease Date\u003c/th\u003e\n\u003cth align=\"center\"\u003eMax Length\u003c/th\u003e\n\u003cth align=\"center\"\u003eSystem Prompt Enhancement\u003c/th\u003e\n\u003cth align=\"center\"\u003e# of Pretrained Tokens\u003c/th\u003e\n\u003cth align=\"center\"\u003eMinimum GPU Memory Usage of Finetuning (Q-Lora)\u003c/th\u003e\n\u003cth align=\"center\"\u003eMinimum GPU Usage of Generating 2048 Tokens (Int4)\u003c/th\u003e\n\u003cth align=\"center\"\u003eTool Usage\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eQwen-1.8B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e23.11.30\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003ctd align=\"center\"\u003e2.2T\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5.8GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e2.9GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eQwen-7B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e23.08.03\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e❎\u003c/td\u003e\n\u003ctd align=\"center\"\u003e2.4T\u003c/td\u003e\n\u003ctd align=\"center\"\u003e11.5GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e8.2GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eQwen-14B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e23.09.25\u003c/td\u003e\n\u003ctd align=\"center\"\u003e8K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e❎\u003c/td\u003e\n\u003ctd align=\"center\"\u003e3.0T\u003c/td\u003e\n\u003ctd align=\"center\"\u003e18.7GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e13.0GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eQwen-72B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e23.11.30\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003ctd align=\"center\"\u003e3.0T\u003c/td\u003e\n\u003ctd align=\"center\"\u003e61.4GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e48.9GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eIn this repo, you can figure out:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eQuickstart with Qwen, and enjoy the simple inference.\u003c/li\u003e\n\u003cli\u003eDetails about the quantization models, including GPTQ and KV cache quantization.\u003c/li\u003e\n\u003cli\u003eStatistics of inference performance, including speed and memory.\u003c/li\u003e\n\u003cli\u003eTutorials on finetuning, including full-parameter tuning, LoRA, and Q-LoRA.\u003c/li\u003e\n\u003cli\u003eInstructions on deployment, with the example of vLLM and FastChat.\u003c/li\u003e\n\u003cli\u003eInstructions on building demos, including WebUI, CLI demo, etc.\u003c/li\u003e\n\u003cli\u003eIntroduction to DashScope API service, as well as the instructions on building an OpenAI-style API for your model.\u003c/li\u003e\n\u003cli\u003eInformation about Qwen for tool use, agent, and code interpreter\u003c/li\u003e\n\u003cli\u003eStatistics of long-context understanding evaluation\u003c/li\u003e\n\u003cli\u003eLicense agreement\u003c/li\u003e\n\u003cli\u003e...\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eAlso, if you meet problems, turn to \u003ca href=\"/QwenLM/Qwen/blob/main/FAQ.md\"\u003eFAQ\u003c/a\u003e for help first. Still feeling struggled? Feel free to shoot us issues (better in English so that more people can understand you)! If you would like to help us, send us pull requests with no hesitation! We are always excited about PR!\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWould like to chat with us or date us coffee time? Welcome to our Discord or WeChat!\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNews and Updates\u003c/h2\u003e\u003ca id=\"user-content-news-and-updates\" class=\"anchor\" aria-label=\"Permalink: News and Updates\" href=\"#news-and-updates\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e2023.11.30 🔥 We release \u003cstrong\u003eQwen-72B\u003c/strong\u003e and \u003cstrong\u003eQwen-72B-Chat\u003c/strong\u003e, which are trained on 3T tokens and support 32k context, along with \u003cstrong\u003eQwen-1.8B\u003c/strong\u003e, and \u003cstrong\u003eQwen-1.8B-Chat\u003c/strong\u003e, on ModelScope and Hugging Face. We have also strengthened the System Prompt capabilities of the Qwen-72B-Chat and Qwen-1.8B-Chat, see \u003ca href=\"/QwenLM/Qwen/blob/main/examples/system_prompt.md\"\u003eexample documentation\u003c/a\u003e. Additionally, support the inference on \u003cstrong\u003eAscend 910\u003c/strong\u003e and \u003cstrong\u003eHygon DCU\u003c/strong\u003e. Check \u003ccode\u003eascend-support\u003c/code\u003e and \u003ccode\u003edcu-support\u003c/code\u003e for more details.\u003c/li\u003e\n\u003cli\u003e2023.10.17 We release the Int8 quantized model \u003cstrong\u003eQwen-7B-Chat-Int8\u003c/strong\u003e and \u003cstrong\u003eQwen-14B-Chat-Int8\u003c/strong\u003e.\u003c/li\u003e\n\u003cli\u003e2023.9.25 🔥 We release \u003cstrong\u003eQwen-14B\u003c/strong\u003e and \u003cstrong\u003eQwen-14B-Chat\u003c/strong\u003e on ModelScope and Hugging Face, along with \u003ca href=\"https://github.com/QwenLM/qwen.cpp\"\u003eqwen.cpp\u003c/a\u003e and \u003ca href=\"https://github.com/QwenLM/Qwen-Agent\"\u003eQwen-Agent\u003c/a\u003e. Codes and checkpoints of \u003cstrong\u003eQwen-7B\u003c/strong\u003e and \u003cstrong\u003eQwen-7B-Chat\u003c/strong\u003e are also updated. \u003cstrong\u003ePLEASE PULL THE LATEST VERSION!\u003c/strong\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eCompared to \u003cstrong\u003eQwen-7B\u003c/strong\u003e (original), \u003cstrong\u003eQwen-7B\u003c/strong\u003e uses more training tokens, increasing from 2.2T tokens to 2.4T tokens, while the context length extends from 2048 to 8192. The Chinese knowledge and coding ability of \u003cstrong\u003eQwen-7B\u003c/strong\u003e have been further improved.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e2023.9.12 We now support finetuning on the Qwen-7B models, including full-parameter finetuning, LoRA and Q-LoRA.\u003c/li\u003e\n\u003cli\u003e2023.8.21 We release the Int4 quantized model for Qwen-7B-Chat, \u003cstrong\u003eQwen-7B-Chat-Int4\u003c/strong\u003e, which requires low memory costs but achieves improved inference speed. Besides, there is no significant performance degradation on the benchmark evaluation.\u003c/li\u003e\n\u003cli\u003e2023.8.3 We release both \u003cstrong\u003eQwen-7B\u003c/strong\u003e and \u003cstrong\u003eQwen-7B-Chat\u003c/strong\u003e on ModelScope and Hugging Face. We also provide a technical memo for more details about the model, including training details and model performance.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePerformance\u003c/h2\u003e\u003ca id=\"user-content-performance\" class=\"anchor\" aria-label=\"Permalink: Performance\" href=\"#performance\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eQwen models outperform the baseline models of similar model sizes on a series of benchmark datasets, e.g., MMLU, C-Eval, GSM8K, MATH, HumanEval, MBPP, BBH, etc., which evaluate the models’ capabilities on natural language understanding, mathematic problem solving, coding, etc. Qwen-72B achieves better performance than LLaMA2-70B on all tasks and outperforms GPT-3.5 on 7 out of 10 tasks.\u003c/p\u003e\n\u003cp align=\"left\" dir=\"auto\"\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/radar_72b.jpg\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/radar_72b.jpg\" width=\"600px/\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003cbr\u003e\n\u003c/p\u003e\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth align=\"left\"\u003eModel\u003c/th\u003e\n\u003cth align=\"center\"\u003eMMLU\u003c/th\u003e\n\u003cth align=\"center\"\u003eC-Eval\u003c/th\u003e\n\u003cth align=\"center\"\u003eGSM8K\u003c/th\u003e\n\u003cth align=\"center\"\u003eMATH\u003c/th\u003e\n\u003cth align=\"center\"\u003eHumanEval\u003c/th\u003e\n\u003cth align=\"center\"\u003eMBPP\u003c/th\u003e\n\u003cth align=\"center\"\u003eBBH\u003c/th\u003e\n\u003cth align=\"center\"\u003eCMMLU\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e8-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e4-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e0-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e3-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e3-shot\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5-shot\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eLLaMA2-7B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e46.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e16.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e3.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e12.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e20.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e38.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e31.8\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eLLaMA2-13B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e41.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e29.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e18.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e30.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e45.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e38.4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eLLaMA2-34B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e62.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e42.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e6.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e22.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e33.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e44.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eChatGLM2-6B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e47.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e51.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e6.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e33.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eInternLM-7B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e51.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e53.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e31.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e6.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e10.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e14.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e37.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e51.8\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eInternLM-20B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e62.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e58.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e52.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e7.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e25.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e35.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e52.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.0\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eBaichuan2-7B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e54.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e56.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e24.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e5.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e18.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e24.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e41.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e57.1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eBaichuan2-13B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e52.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e10.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e17.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e30.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e49.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e62.0\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eYi-34B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e76.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e81.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e67.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e26.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e38.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e66.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e82.6\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eXVERSE-65B\u003c/td\u003e\n\u003ctd align=\"center\"\u003e70.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e68.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e60.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e26.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003cstrong\u003eQwen-1.8B\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e45.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e56.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e2.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e14.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e22.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e52.1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003cstrong\u003eQwen-7B\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e58.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e63.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e51.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e11.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e29.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e31.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e45.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e62.2\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003cstrong\u003eQwen-14B\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e66.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e72.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e61.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e24.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e40.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e53.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e71.0\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003cstrong\u003eQwen-72B\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e77.4\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e83.3\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e78.9\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e35.2\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e35.4\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e52.2\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e67.7\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e83.6\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eFor all compared models, we report the best scores between their official reported results and \u003ca href=\"https://opencompass.org.cn/leaderboard-llm\" rel=\"nofollow\"\u003eOpenCompass\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor more experimental results (detailed model performance on more benchmark datasets) and details, please refer to our technical report by clicking \u003ca href=\"https://qianwen-res.oss-cn-beijing.aliyuncs.com/QWEN_TECHNICAL_REPORT.pdf\" rel=\"nofollow\"\u003ehere\u003c/a\u003e.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRequirements\u003c/h2\u003e\u003ca id=\"user-content-requirements\" class=\"anchor\" aria-label=\"Permalink: Requirements\" href=\"#requirements\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003epython 3.8 and above\u003c/li\u003e\n\u003cli\u003epytorch 1.12 and above, 2.0 and above are recommended\u003c/li\u003e\n\u003cli\u003etransformers 4.32 and above\u003c/li\u003e\n\u003cli\u003eCUDA 11.4 and above are recommended (this is for GPU users, flash-attention users, etc.)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuickstart\u003c/h2\u003e\u003ca id=\"user-content-quickstart\" class=\"anchor\" aria-label=\"Permalink: Quickstart\" href=\"#quickstart\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBelow, we provide simple examples to show how to use Qwen-Chat with 🤖 ModelScope and 🤗 Transformers.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou can use our pre-built docker images to skip most of the environment setup steps, see Section \u003ca href=\"#-docker\"\u003e\"Using Pre-built Docker Images\"\u003c/a\u003e for more details.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf not using docker, please make sure you have setup the environment and installed the required packages. Make sure you meet the above requirements, and then install the dependent libraries.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install -r requirements.txt\"\u003e\u003cpre\u003epip install -r requirements.txt\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf your device supports fp16 or bf16, we recommend installing \u003ca href=\"https://github.com/Dao-AILab/flash-attention\"\u003eflash-attention\u003c/a\u003e (\u003cstrong\u003ewe support flash attention 2 now.\u003c/strong\u003e) for higher efficiency and lower memory usage. (\u003cstrong\u003eflash-attention is optional and the project can run normally without installing it\u003c/strong\u003e)\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"git clone https://github.com/Dao-AILab/flash-attention\ncd flash-attention \u0026amp;\u0026amp; pip install .\n# Below are optional. Installing them might be slow.\n# pip install csrc/layer_norm\n# If the version of flash-attn is higher than 2.1.1, the following is not needed.\n# pip install csrc/rotary\"\u003e\u003cpre\u003egit clone https://github.com/Dao-AILab/flash-attention\n\u003cspan class=\"pl-c1\"\u003ecd\u003c/span\u003e flash-attention \u003cspan class=\"pl-k\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e pip install \u003cspan class=\"pl-c1\"\u003e.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Below are optional. Installing them might be slow.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e pip install csrc/layer_norm\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e If the version of flash-attn is higher than 2.1.1, the following is not needed.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e pip install csrc/rotary\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNow you can start with ModelScope or Transformers.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🤗 Transformers\u003c/h3\u003e\u003ca id=\"user-content--transformers\" class=\"anchor\" aria-label=\"Permalink: 🤗 Transformers\" href=\"#-transformers\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo use Qwen-Chat for the inference, all you need to do is to input a few lines of codes as demonstrated below. Remember to pass in the correct model names or paths, such as \"Qwen/Qwen-7B-Chat\" and \"Qwen/Qwen-14B-Chat\". However, \u003cstrong\u003eplease make sure that you are using the latest code.\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from transformers import AutoModelForCausalLM, AutoTokenizer\nfrom transformers.generation import GenerationConfig\n\n# Model names: \u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, \u0026quot;Qwen/Qwen-14B-Chat\u0026quot;\ntokenizer = AutoTokenizer.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, trust_remote_code=True)\n\n# use bf16\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, device_map=\u0026quot;auto\u0026quot;, trust_remote_code=True, bf16=True).eval()\n# use fp16\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, device_map=\u0026quot;auto\u0026quot;, trust_remote_code=True, fp16=True).eval()\n# use cpu only\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, device_map=\u0026quot;cpu\u0026quot;, trust_remote_code=True).eval()\n# use auto mode, automatically select precision based on the device.\nmodel = AutoModelForCausalLM.from_pretrained(\n \u0026quot;Qwen/Qwen-7B-Chat\u0026quot;,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\n\n# Specify hyperparameters for generation. But if you use transformers\u0026gt;=4.32.0, there is no need to do this.\n# model.generation_config = GenerationConfig.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, trust_remote_code=True)\n\n# 1st dialogue turn\nresponse, history = model.chat(tokenizer, \u0026quot;你好\u0026quot;, history=None)\nprint(response)\n# 你好!很高兴为你提供帮助。\n\n# 2nd dialogue turn\nresponse, history = model.chat(tokenizer, \u0026quot;给我讲一个年轻人奋斗创业最终取得成功的故事。\u0026quot;, history=history)\nprint(response)\n# 这是一个关于一个年轻人奋斗创业最终取得成功的故事。\n# 故事的主人公叫李明,他来自一个普通的家庭,父母都是普通的工人。从小,李明就立下了一个目标:要成为一名成功的企业家。\n# 为了实现这个目标,李明勤奋学习,考上了大学。在大学期间,他积极参加各种创业比赛,获得了不少奖项。他还利用课余时间去实习,积累了宝贵的经验。\n# 毕业后,李明决定开始自己的创业之路。他开始寻找投资机会,但多次都被拒绝了。然而,他并没有放弃。他继续努力,不断改进自己的创业计划,并寻找新的投资机会。\n# 最终,李明成功地获得了一笔投资,开始了自己的创业之路。他成立了一家科技公司,专注于开发新型软件。在他的领导下,公司迅速发展起来,成为了一家成功的科技企业。\n# 李明的成功并不是偶然的。他勤奋、坚韧、勇于冒险,不断学习和改进自己。他的成功也证明了,只要努力奋斗,任何人都有可能取得成功。\n\n# 3rd dialogue turn\nresponse, history = model.chat(tokenizer, \u0026quot;给这个故事起一个标题\u0026quot;, history=history)\nprint(response)\n# 《奋斗创业:一个年轻人的成功之路》\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003egeneration\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Model names: \"Qwen/Qwen-7B-Chat\", \"Qwen/Qwen-14B-Chat\"\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\n\u003cspan class=\"pl-c\"\u003e# use bf16\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B-Chat\", device_map=\"auto\", trust_remote_code=True, bf16=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use fp16\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B-Chat\", device_map=\"auto\", trust_remote_code=True, fp16=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use cpu only\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B-Chat\", device_map=\"cpu\", trust_remote_code=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use auto mode, automatically select precision based on the device.\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\n\u003cspan class=\"pl-c\"\u003e# Specify hyperparameters for generation. But if you use transformers\u0026gt;=4.32.0, there is no need to do this.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model.generation_config = GenerationConfig.from_pretrained(\"Qwen/Qwen-7B-Chat\", trust_remote_code=True)\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 1st dialogue turn\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# 你好!很高兴为你提供帮助。\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 2nd dialogue turn\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"给我讲一个年轻人奋斗创业最终取得成功的故事。\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# 这是一个关于一个年轻人奋斗创业最终取得成功的故事。\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# 故事的主人公叫李明,他来自一个普通的家庭,父母都是普通的工人。从小,李明就立下了一个目标:要成为一名成功的企业家。\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# 为了实现这个目标,李明勤奋学习,考上了大学。在大学期间,他积极参加各种创业比赛,获得了不少奖项。他还利用课余时间去实习,积累了宝贵的经验。\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# 毕业后,李明决定开始自己的创业之路。他开始寻找投资机会,但多次都被拒绝了。然而,他并没有放弃。他继续努力,不断改进自己的创业计划,并寻找新的投资机会。\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# 最终,李明成功地获得了一笔投资,开始了自己的创业之路。他成立了一家科技公司,专注于开发新型软件。在他的领导下,公司迅速发展起来,成为了一家成功的科技企业。\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# 李明的成功并不是偶然的。他勤奋、坚韧、勇于冒险,不断学习和改进自己。他的成功也证明了,只要努力奋斗,任何人都有可能取得成功。\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 3rd dialogue turn\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"给这个故事起一个标题\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# 《奋斗创业:一个年轻人的成功之路》\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eRunning Qwen, the base language model, is also simple.\u003c/p\u003e\n\u003cdetails\u003e\n \u003csummary\u003eRunning Qwen\u003c/summary\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from transformers import AutoModelForCausalLM, AutoTokenizer\nfrom transformers.generation import GenerationConfig\n\n# Model names: \u0026quot;Qwen/Qwen-7B\u0026quot;, \u0026quot;Qwen/Qwen-14B\u0026quot; \ntokenizer = AutoTokenizer.from_pretrained(\u0026quot;Qwen/Qwen-7B\u0026quot;, trust_remote_code=True)\n# use bf16\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B\u0026quot;, device_map=\u0026quot;auto\u0026quot;, trust_remote_code=True, bf16=True).eval()\n# use fp16\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B\u0026quot;, device_map=\u0026quot;auto\u0026quot;, trust_remote_code=True, fp16=True).eval()\n# use cpu only\n# model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B\u0026quot;, device_map=\u0026quot;cpu\u0026quot;, trust_remote_code=True).eval()\n# use auto mode, automatically select precision based on the device.\nmodel = AutoModelForCausalLM.from_pretrained(\n \u0026quot;Qwen/Qwen-7B\u0026quot;,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\n\n# Specify hyperparameters for generation. But if you use transformers\u0026gt;=4.32.0, there is no need to do this.\n# model.generation_config = GenerationConfig.from_pretrained(\u0026quot;Qwen/Qwen-7B\u0026quot;, trust_remote_code=True)\n\ninputs = tokenizer('蒙古国的首都是乌兰巴托(Ulaanbaatar)\\n冰岛的首都是雷克雅未克(Reykjavik)\\n埃塞俄比亚的首都是', return_tensors='pt')\ninputs = inputs.to(model.device)\npred = model.generate(**inputs)\nprint(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))\n# 蒙古国的首都是乌兰巴托(Ulaanbaatar)\\n冰岛的首都是雷克雅未克(Reykjavik)\\n埃塞俄比亚的首都是亚的斯亚贝巴(Addis Ababa)...\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003egeneration\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Model names: \"Qwen/Qwen-7B\", \"Qwen/Qwen-14B\" \u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# use bf16\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B\", device_map=\"auto\", trust_remote_code=True, bf16=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use fp16\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B\", device_map=\"auto\", trust_remote_code=True, fp16=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use cpu only\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model = AutoModelForCausalLM.from_pretrained(\"Qwen/Qwen-7B\", device_map=\"cpu\", trust_remote_code=True).eval()\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# use auto mode, automatically select precision based on the device.\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\n\u003cspan class=\"pl-c\"\u003e# Specify hyperparameters for generation. But if you use transformers\u0026gt;=4.32.0, there is no need to do this.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model.generation_config = GenerationConfig.from_pretrained(\"Qwen/Qwen-7B\", trust_remote_code=True)\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003einputs\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etokenizer\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'蒙古国的首都是乌兰巴托(Ulaanbaatar)\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e冰岛的首都是雷克雅未克(Reykjavik)\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e埃塞俄比亚的首都是'\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ereturn_tensors\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'pt'\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003einputs\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003einputs\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eto\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003edevice\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003epred\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egenerate\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e**\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003einputs\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003edecode\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003epred\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecpu\u003c/span\u003e()[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e], \u003cspan class=\"pl-s1\"\u003eskip_special_tokens\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e))\n\u003cspan class=\"pl-c\"\u003e# 蒙古国的首都是乌兰巴托(Ulaanbaatar)\\n冰岛的首都是雷克雅未克(Reykjavik)\\n埃塞俄比亚的首都是亚的斯亚贝巴(Addis Ababa)...\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/details\u003e\n\u003cp id=\"user-content-downloadmodel\" dir=\"auto\"\u003e\nIn the event of a network issue while attempting to download model checkpoints and codes from HuggingFace, an alternative approach is to initially fetch the checkpoint from ModelScope and then load it from the local directory as outlined below:\n\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from modelscope import snapshot_download\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Downloading model checkpoint to a local dir model_dir\n# model_dir = snapshot_download('qwen/Qwen-7B')\n# model_dir = snapshot_download('qwen/Qwen-7B-Chat')\n# model_dir = snapshot_download('qwen/Qwen-14B')\nmodel_dir = snapshot_download('qwen/Qwen-14B-Chat')\n\n# Loading local checkpoints\n# trust_remote_code is still set as True since we still load codes from local dir instead of transformers\ntokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)\nmodel = AutoModelForCausalLM.from_pretrained(\n model_dir,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodelscope\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003esnapshot_download\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Downloading model checkpoint to a local dir model_dir\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model_dir = snapshot_download('qwen/Qwen-7B')\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model_dir = snapshot_download('qwen/Qwen-7B-Chat')\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# model_dir = snapshot_download('qwen/Qwen-14B')\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel_dir\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003esnapshot_download\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'qwen/Qwen-14B-Chat'\u003c/span\u003e)\n\n\u003cspan class=\"pl-c\"\u003e# Loading local checkpoints\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# trust_remote_code is still set as True since we still load codes from local dir instead of transformers\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003emodel_dir\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003emodel_dir\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🤖 ModelScope\u003c/h3\u003e\u003ca id=\"user-content--modelscope\" class=\"anchor\" aria-label=\"Permalink: 🤖 ModelScope\" href=\"#-modelscope\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eModelScope is an open-source platform for Model-as-a-Service (MaaS), which provides flexible and cost-effective model service to AI developers. Similarly, you can run the models with ModelScope as shown below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from modelscope import AutoModelForCausalLM, AutoTokenizer\nfrom modelscope import GenerationConfig\n\n# Model names: \u0026quot;qwen/Qwen-7B-Chat\u0026quot;, \u0026quot;qwen/Qwen-14B-Chat\u0026quot;\ntokenizer = AutoTokenizer.from_pretrained(\u0026quot;qwen/Qwen-7B-Chat\u0026quot;, trust_remote_code=True)\nmodel = AutoModelForCausalLM.from_pretrained(\u0026quot;qwen/Qwen-7B-Chat\u0026quot;, device_map=\u0026quot;auto\u0026quot;, trust_remote_code=True, fp16=True).eval()\nmodel.generation_config = GenerationConfig.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, trust_remote_code=True) # 可指定不同的生成长度、top_p等相关超参\n\nresponse, history = model.chat(tokenizer, \u0026quot;你好\u0026quot;, history=None)\nprint(response)\nresponse, history = model.chat(tokenizer, \u0026quot;浙江的省会在哪里?\u0026quot;, history=history) \nprint(response)\nresponse, history = model.chat(tokenizer, \u0026quot;它有什么好玩的景点\u0026quot;, history=history)\nprint(response)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodelscope\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodelscope\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Model names: \"qwen/Qwen-7B-Chat\", \"qwen/Qwen-14B-Chat\"\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"qwen/Qwen-7B-Chat\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"qwen/Qwen-7B-Chat\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003efp16\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egeneration_config\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e) \u003cspan class=\"pl-c\"\u003e# 可指定不同的生成长度、top_p等相关超参\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"浙江的省会在哪里?\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e) \n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"它有什么好玩的景点\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBatch Inference\u003c/h3\u003e\u003ca id=\"user-content-batch-inference\" class=\"anchor\" aria-label=\"Permalink: Batch Inference\" href=\"#batch-inference\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eQwen supports batch inference. With flash attention enabled, using batch inference can bring a 40% speedup. The example code is shown below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nfrom transformers import GenerationConfig\nfrom qwen_generation_utils import make_context, decode_tokens, get_stop_words_ids\n\n# To generate attention masks automatically, it is necessary to assign distinct\n# token_ids to pad_token and eos_token, and set pad_token_id in the generation_config.\ntokenizer = AutoTokenizer.from_pretrained(\n './',\n pad_token='\u0026lt;|extra_0|\u0026gt;',\n eos_token='\u0026lt;|endoftext|\u0026gt;',\n padding_side='left',\n trust_remote_code=True\n)\nmodel = AutoModelForCausalLM.from_pretrained(\n './',\n pad_token_id=tokenizer.pad_token_id,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\nmodel.generation_config = GenerationConfig.from_pretrained('./', pad_token_id=tokenizer.pad_token_id)\n\nall_raw_text = [\u0026quot;我想听你说爱我。\u0026quot;, \u0026quot;今天我想吃点啥,甜甜的,推荐下\u0026quot;, \u0026quot;我马上迟到了,怎么做才能不迟到\u0026quot;]\nbatch_raw_text = []\nfor q in all_raw_text:\n raw_text, _ = make_context(\n tokenizer,\n q,\n system=\u0026quot;You are a helpful assistant.\u0026quot;,\n max_window_size=model.generation_config.max_window_size,\n chat_format=model.generation_config.chat_format,\n )\n batch_raw_text.append(raw_text)\n\nbatch_input_ids = tokenizer(batch_raw_text, padding='longest')\nbatch_input_ids = torch.LongTensor(batch_input_ids['input_ids']).to(model.device)\nbatch_out_ids = model.generate(\n batch_input_ids,\n return_dict_in_generate=False,\n generation_config=model.generation_config\n)\npadding_lens = [batch_input_ids[i].eq(tokenizer.pad_token_id).sum().item() for i in range(batch_input_ids.size(0))]\n\nbatch_response = [\n decode_tokens(\n batch_out_ids[i][padding_lens[i]:],\n tokenizer,\n raw_text_len=len(batch_raw_text[i]),\n context_length=(batch_input_ids[i].size(0)-padding_lens[i]),\n chat_format=\u0026quot;chatml\u0026quot;,\n verbose=False,\n errors='replace'\n ) for i in range(len(all_raw_text))\n]\nprint(batch_response)\n\nresponse, _ = model.chat(tokenizer, \u0026quot;我想听你说爱我。\u0026quot;, history=None)\nprint(response)\n\nresponse, _ = model.chat(tokenizer, \u0026quot;今天我想吃点啥,甜甜的,推荐下\u0026quot;, history=None)\nprint(response)\n\nresponse, _ = model.chat(tokenizer, \u0026quot;我马上迟到了,怎么做才能不迟到\u0026quot;, history=None)\nprint(response)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eqwen_generation_utils\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emake_context\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003edecode_tokens\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eget_stop_words_ids\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# To generate attention masks automatically, it is necessary to assign distinct\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# token_ids to pad_token and eos_token, and set pad_token_id in the generation_config.\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e'./'\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003epad_token\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'\u0026lt;|extra_0|\u0026gt;'\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eeos_token\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'\u0026lt;|endoftext|\u0026gt;'\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003epadding_side\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'left'\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n)\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e'./'\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003epad_token_id\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003epad_token_id\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egeneration_config\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'./'\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003epad_token_id\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003epad_token_id\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003eall_raw_text\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e [\u003cspan class=\"pl-s\"\u003e\"我想听你说爱我。\"\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"今天我想吃点啥,甜甜的,推荐下\"\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"我马上迟到了,怎么做才能不迟到\"\u003c/span\u003e]\n\u003cspan class=\"pl-s1\"\u003ebatch_raw_text\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e []\n\u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eq\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eall_raw_text\u003c/span\u003e:\n \u003cspan class=\"pl-s1\"\u003eraw_text\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e_\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emake_context\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eq\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003esystem\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"You are a helpful assistant.\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003emax_window_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egeneration_config\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003emax_window_size\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003echat_format\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egeneration_config\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat_format\u003c/span\u003e,\n )\n \u003cspan class=\"pl-s1\"\u003ebatch_raw_text\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eappend\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eraw_text\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etokenizer\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_raw_text\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003epadding\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'longest'\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eLongTensor\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'input_ids'\u003c/span\u003e]).\u003cspan class=\"pl-c1\"\u003eto\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003edevice\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003ebatch_out_ids\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egenerate\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003ereturn_dict_in_generate\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003egeneration_config\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003egeneration_config\u003c/span\u003e\n)\n\u003cspan class=\"pl-s1\"\u003epadding_lens\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e [\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e].\u003cspan class=\"pl-c1\"\u003eeq\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003epad_token_id\u003c/span\u003e).\u003cspan class=\"pl-c1\"\u003esum\u003c/span\u003e().\u003cspan class=\"pl-c1\"\u003eitem\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-en\"\u003erange\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e))]\n\n\u003cspan class=\"pl-s1\"\u003ebatch_response\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e [\n \u003cspan class=\"pl-en\"\u003edecode_tokens\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003ebatch_out_ids\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e][\u003cspan class=\"pl-s1\"\u003epadding_lens\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e]:],\n \u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eraw_text_len\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-en\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_raw_text\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e]),\n \u003cspan class=\"pl-s1\"\u003econtext_length\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_input_ids\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e].\u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e)\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003epadding_lens\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e]),\n \u003cspan class=\"pl-s1\"\u003echat_format\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"chatml\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003everbose\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eerrors\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'replace'\u003c/span\u003e\n ) \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-en\"\u003erange\u003c/span\u003e(\u003cspan class=\"pl-en\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eall_raw_text\u003c/span\u003e))\n]\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_response\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e_\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"我想听你说爱我。\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e_\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"今天我想吃点啥,甜甜的,推荐下\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e_\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"我马上迟到了,怎么做才能不迟到\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCPU\u003c/h3\u003e\u003ca id=\"user-content-cpu\" class=\"anchor\" aria-label=\"Permalink: CPU\" href=\"#cpu\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo deploy our models on CPU, we strongly advise you to use \u003ca href=\"https://github.com/QwenLM/qwen.cpp\"\u003eqwen.cpp\u003c/a\u003e, which is a pure C++ implementation of Qwen and tiktoken. Check the repo for more details!\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAlso, it is also simple to directly run the model on CPU, which requires your specification of device:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"model = AutoModelForCausalLM.from_pretrained(\u0026quot;Qwen/Qwen-7B-Chat\u0026quot;, device_map=\u0026quot;cpu\u0026quot;, trust_remote_code=True).eval()\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"cpu\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHowever, it is likely that you suffer from extremely low inference efficiency.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMultiple GPUs\u003c/h3\u003e\u003ca id=\"user-content-multiple-gpus\" class=\"anchor\" aria-label=\"Permalink: Multiple GPUs\" href=\"#multiple-gpus\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you suffer from lack of GPU memory and you would like to run the model on more than 1 GPU, you can directly use the default loading method, which is now supported by Transformers. The previous method based on \u003ccode\u003eutils.py\u003c/code\u003e is deprecated.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eHowever, though this method is simple, the efficiency of the native pipeline parallelism is low. We advise you to use vLLM with FastChat and please read the section for deployment.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ex86 Platforms\u003c/h3\u003e\u003ca id=\"user-content-x86-platforms\" class=\"anchor\" aria-label=\"Permalink: x86 Platforms\" href=\"#x86-platforms\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhen deploy on Core™/Xeon® Scalable Processors or with Arc™ GPU, \u003ca href=\"https://docs.openvino.ai/2023.3/gen_ai_guide.html\" rel=\"nofollow\"\u003eOpenVINO™ Toolkit\u003c/a\u003e is recommended. You can install and run this \u003ca href=\"https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/254-llm-chatbot\"\u003eexample notebook\u003c/a\u003e. For related issues, you are welcome to file an issue at \u003ca href=\"https://github.com/openvinotoolkit/openvino_notebooks/issues\"\u003eOpenVINO repo\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDashScope\u003c/h3\u003e\u003ca id=\"user-content-dashscope\" class=\"anchor\" aria-label=\"Permalink: DashScope\" href=\"#dashscope\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe most simple way to use Qwen through APIs is DashScope API service through Alibaba Cloud. We give an introduction to the usage. Additionally, we provide a script for you to deploy an OpenAI-style API on your own servers.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eDashScope is the large language model API service provided by Alibaba Cloud, which now supports Qwen. Note that the models behind DashScope are in-house versions temporarily without details provided. The services include \u003ccode\u003eqwen-turbo\u003c/code\u003e and \u003ccode\u003eqwen-plus\u003c/code\u003e, where the former one runs faster and the latter achieves better performance. For more information, visit the documentation \u003ca href=\"https://dashscope.aliyun.com\" rel=\"nofollow\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003ePlease head to the official website \u003ca href=\"https://help.aliyun.com/zh/dashscope/developer-reference/activate-dashscope-and-create-an-api-key?spm=a2c4g.11186623.0.0.6c2774fahtfXdn\" rel=\"nofollow\"\u003elink\u003c/a\u003e to create a DashScope account and obtain the API key (AK). We recommend setting the AK with an environment variable:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"export DASHSCOPE_API_KEY=\u0026quot;YOUR_DASHSCOPE_API_KEY\u0026quot;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eexport\u003c/span\u003e DASHSCOPE_API_KEY=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eYOUR_DASHSCOPE_API_KEY\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThen please install the packages and click \u003ca href=\"https://help.aliyun.com/zh/dashscope/developer-reference/install-dashscope-sdk\" rel=\"nofollow\"\u003ehere\u003c/a\u003e for the documentation. If you use Python, you can install DashScope with pip:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install dashscope\"\u003e\u003cpre\u003epip install dashscope\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you use JAVA SDK, you can install it in this way:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-xml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"\u0026lt;!-- https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java --\u0026gt;\n\u0026lt;dependency\u0026gt;\n \u0026lt;groupId\u0026gt;com.alibaba\u0026lt;/groupId\u0026gt;\n \u0026lt;artifactId\u0026gt;dashscope-sdk-java\u0026lt;/artifactId\u0026gt;\n \u0026lt;version\u0026gt;the-latest-version\u0026lt;/version\u0026gt;\n\u0026lt;/dependency\u0026gt;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e\u0026lt;!--\u003c/span\u003e https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java \u003cspan class=\"pl-c\"\u003e--\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\u0026lt;\u003cspan class=\"pl-ent\"\u003edependency\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003egroupId\u003c/span\u003e\u0026gt;com.alibaba\u0026lt;/\u003cspan class=\"pl-ent\"\u003egroupId\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eartifactId\u003c/span\u003e\u0026gt;dashscope-sdk-java\u0026lt;/\u003cspan class=\"pl-ent\"\u003eartifactId\u003c/span\u003e\u0026gt;\n \u0026lt;\u003cspan class=\"pl-ent\"\u003eversion\u003c/span\u003e\u0026gt;the-latest-version\u0026lt;/\u003cspan class=\"pl-ent\"\u003eversion\u003c/span\u003e\u0026gt;\n\u0026lt;/\u003cspan class=\"pl-ent\"\u003edependency\u003c/span\u003e\u0026gt;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe simplest way to use DashScope is the usage with messages, which is similar to OpenAI API. The example is demonstrated below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import random\nfrom http import HTTPStatus\nfrom dashscope import Generation\n\n\ndef call_with_messages():\n messages = [{'role': 'system', 'content': 'You are a helpful assistant.'},\n {'role': 'user', 'content': '如何做西红柿鸡蛋?'}]\n gen = Generation()\n response = gen.call(\n Generation.Models.qwen_turbo,\n messages=messages,\n seed=random.randint(1, 10000), # set the random seed, optional, default to 1234 if not set\n result_format='message', # set the result to be \u0026quot;message\u0026quot; format.\n )\n return response\n\n\nif __name__ == '__main__':\n response = call_with_messages()\n if response.status_code == HTTPStatus.OK:\n print(response)\n else:\n print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (\n response.request_id, response.status_code,\n response.code, response.message\n ))\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003erandom\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehttp\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eHTTPStatus\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003edashscope\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGeneration\u003c/span\u003e\n\n\n\u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecall_with_messages\u003c/span\u003e():\n \u003cspan class=\"pl-s1\"\u003emessages\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e [{\u003cspan class=\"pl-s\"\u003e'role'\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e'system'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'content'\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e'You are a helpful assistant.'\u003c/span\u003e},\n {\u003cspan class=\"pl-s\"\u003e'role'\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e'user'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'content'\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e'如何做西红柿鸡蛋?'\u003c/span\u003e}]\n \u003cspan class=\"pl-s1\"\u003egen\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGeneration\u003c/span\u003e()\n \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003egen\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecall\u003c/span\u003e(\n \u003cspan class=\"pl-v\"\u003eGeneration\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eModels\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eqwen_turbo\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003emessages\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003emessages\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eseed\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003erandom\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandint\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e10000\u003c/span\u003e), \u003cspan class=\"pl-c\"\u003e# set the random seed, optional, default to 1234 if not set\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003eresult_format\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'message'\u003c/span\u003e, \u003cspan class=\"pl-c\"\u003e# set the result to be \"message\" format.\u003c/span\u003e\n )\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e\n\n\n\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003e__name__\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e'__main__'\u003c/span\u003e:\n \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecall_with_messages\u003c/span\u003e()\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003estatus_code\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eHTTPStatus\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eOK\u003c/span\u003e:\n \u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e:\n \u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'Request id: %s, Status code: %s, error code: %s, error message: %s'\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e%\u003c/span\u003e (\n \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erequest_id\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003estatus_code\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecode\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003emessage\u003c/span\u003e\n ))\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor more usages, please visit the official website for more details.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuantization\u003c/h2\u003e\u003ca id=\"user-content-quantization\" class=\"anchor\" aria-label=\"Permalink: Quantization\" href=\"#quantization\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGPTQ\u003c/h3\u003e\u003ca id=\"user-content-gptq\" class=\"anchor\" aria-label=\"Permalink: GPTQ\" href=\"#gptq\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe provide a solution based on \u003ca href=\"https://github.com/PanQiWei/AutoGPTQ\"\u003eAutoGPTQ\u003c/a\u003e, and release the Int4 and Int8 quantized models, which achieve nearly lossless model effects but improved performance on both memory costs and inference speed.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eHere we demonstrate how to use our provided quantized models for inference. Before you start, make sure you meet the requirements of auto-gptq (e.g., torch 2.0 and above, transformers 4.32.0 and above, etc.) and install the required packages:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install auto-gptq optimum\"\u003e\u003cpre\u003epip install auto-gptq optimum\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you meet problems installing \u003ccode\u003eauto-gptq\u003c/code\u003e, we advise you to check out the official \u003ca href=\"https://github.com/PanQiWei/AutoGPTQ\"\u003erepo\u003c/a\u003e to find a wheel.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eNote: The pre-compiled \u003ccode\u003eauto-gptq\u003c/code\u003e packages strongly depend on the version of \u003ccode\u003etorch\u003c/code\u003e and its CUDA version. Moreover, due to recent update,\nyou may also encounter unsupported version errors from \u003ccode\u003etransformers\u003c/code\u003e, \u003ccode\u003eoptimum\u003c/code\u003e, or \u003ccode\u003epeft\u003c/code\u003e.\nWe recommend using the latest versions meeting the following requirements:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003etorch==2.1 auto-gptq\u0026gt;=0.5.1 transformers\u0026gt;=4.35.0 optimum\u0026gt;=1.14.0 peft\u0026gt;=0.6.1\u003c/li\u003e\n\u003cli\u003etorch\u0026gt;=2.0,\u0026lt;2.1 auto-gptq\u0026lt;0.5.0 transformers\u0026lt;4.35.0 optimum\u0026lt;1.14.0 peft\u0026gt;=0.5.0,\u0026lt;0.6.0\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eThen you can load the quantized model easily and run inference as same as usual:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Model names: \u0026quot;Qwen/Qwen-7B-Chat-Int4\u0026quot;, \u0026quot;Qwen/Qwen-14B-Chat-Int4\u0026quot;\nmodel = AutoModelForCausalLM.from_pretrained(\n \u0026quot;Qwen/Qwen-7B-Chat-Int4\u0026quot;,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\nresponse, history = model.chat(tokenizer, \u0026quot;Hi\u0026quot;, history=None)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# Model names: \"Qwen/Qwen-7B-Chat-Int4\", \"Qwen/Qwen-14B-Chat-Int4\"\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat-Int4\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"Hi\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe illustrate the model performance of both BF16, Int8 and Int4 models on the benchmark, and we find that the quantized model does not suffer from significant performance degradation. Results are shown below:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eQuantization\u003c/th\u003e\n\u003cth align=\"center\"\u003eMMLU\u003c/th\u003e\n\u003cth align=\"center\"\u003eCEval (val)\u003c/th\u003e\n\u003cth align=\"center\"\u003eGSM8K\u003c/th\u003e\n\u003cth align=\"center\"\u003eHumaneval\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-1.8B-Chat (BF16)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e43.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e33.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e26.2\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-1.8B-Chat (Int8)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e43.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e33.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e27.4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-1.8B-Chat (Int4)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e42.9\u003c/td\u003e\n\u003ctd align=\"center\"\u003e52.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e31.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e25.0\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-7B-Chat (BF16)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e50.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e37.2\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-7B-Chat (Int8)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e48.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e34.8\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-7B-Chat (Int4)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e55.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e49.7\u003c/td\u003e\n\u003ctd align=\"center\"\u003e29.9\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-14B-Chat (BF16)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e64.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e69.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e60.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e43.9\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-14B-Chat (Int8)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e63.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e68.6\u003c/td\u003e\n\u003ctd align=\"center\"\u003e60.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e48.2\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-14B-Chat (Int4)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e63.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e69.0\u003c/td\u003e\n\u003ctd align=\"center\"\u003e59.8\u003c/td\u003e\n\u003ctd align=\"center\"\u003e45.7\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-72B-Chat (BF16)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e74.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e80.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e76.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e64.6\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-72B-Chat (Int8)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e73.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e80.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e73.5\u003c/td\u003e\n\u003ctd align=\"center\"\u003e62.2\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eQwen-72B-Chat (Int4)\u003c/td\u003e\n\u003ctd align=\"center\"\u003e73.4\u003c/td\u003e\n\u003ctd align=\"center\"\u003e80.1\u003c/td\u003e\n\u003ctd align=\"center\"\u003e75.3\u003c/td\u003e\n\u003ctd align=\"center\"\u003e61.6\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuantization of KV cache\u003c/h3\u003e\u003ca id=\"user-content-quantization-of-kv-cache\" class=\"anchor\" aria-label=\"Permalink: Quantization of KV cache\" href=\"#quantization-of-kv-cache\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eNOTE: Please be aware that due to the internal mechanism of Hugging Face, the support files for this functionality\n(i.e., \u003ccode\u003ecache_autogptq_cuda_256.cpp\u003c/code\u003e and \u003ccode\u003ecache_autogptq_cuda_kernel_256.cu\u003c/code\u003e) may be missing. Please manually download\nthem from the Hugging Face Hub and place them into the same folder as the other module files.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eThe attention KV cache can be quantized and compressed for storage, to get a higher sample throughput. The arguments \u003ccode\u003euse_cache_quantization\u003c/code\u003e and \u003ccode\u003euse_cache_kernel\u003c/code\u003e in \u003ccode\u003econfig.json\u003c/code\u003e are provided to enable KV cache quantization. The specific use method is as follows:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"model = AutoModelForCausalLM.from_pretrained(\n \u0026quot;Qwen/Qwen-7B-Chat\u0026quot;,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True,\n use_cache_quantization=True,\n use_cache_kernel=True,\n use_flash_attn=False\n)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e\"Qwen/Qwen-7B-Chat\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003euse_cache_quantization\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003euse_cache_kernel\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003euse_flash_attn\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e\n)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAttention: Currently, KV cache quantization and flash attention cannot be used at the same time.\nIf you enable KV cache quantization and flash attention at the same time (\u003ccode\u003euse_flash_attn=True\u003c/code\u003e, \u003ccode\u003euse_cache_quantization=True\u003c/code\u003e, \u003ccode\u003euse_cache_kernel=True\u003c/code\u003e), \u003ccode\u003euse_flash_attn\u003c/code\u003e is disabled by default (\u003ccode\u003euse_flash_attn=false\u003c/code\u003e).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe have verified that the use of the quantized Int8-KV-Cache model does not suffer from significant performance degradation in downstream evaluation. In the following, we focus on profiling its memory footprint in different conditions.\nThe profiling runs on a single A100-SXM4-80G GPU with PyTorch 2.0.1 and CUDA 11.4.\nWe use BF16 models to generate 1024 tokens by default, and \"OOM\" indicates out-of-memory error.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWith KV cache quantization, the model can infer with a larger batch size (bs).\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eUSE KV Cache\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=1\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=4\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=16\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=32\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=64\u003c/th\u003e\n\u003cth align=\"center\"\u003ebs=100\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eNo\u003c/td\u003e\n\u003ctd align=\"center\"\u003e16.3GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e24.1GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e31.7GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e48.7GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003eOOM\u003c/td\u003e\n\u003ctd align=\"center\"\u003eOOM\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eYes\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.5GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e17.2GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e22.3GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e30.2GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e48.2GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e72.4GB\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eWith KV cache quantization the model can save more memory when generating longer sequence (\u003ccode\u003esl\u003c/code\u003e, sequence length, referring to the number of tokens generated) at the stage of inference.\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eUSE KV Cache\u003c/th\u003e\n\u003cth align=\"center\"\u003esl=512\u003c/th\u003e\n\u003cth align=\"center\"\u003esl=1024\u003c/th\u003e\n\u003cth align=\"center\"\u003esl=2048\u003c/th\u003e\n\u003cth align=\"center\"\u003esl=4096\u003c/th\u003e\n\u003cth align=\"center\"\u003esl=8192\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eNo\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.2GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e16.3GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e17.6GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e19.5GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e23.2GB\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eYes\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.5GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e15.8GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e16.6GB\u003c/td\u003e\n\u003ctd align=\"center\"\u003e17.6GB\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eThe model with KV cache quantization will convert the format of \u003ccode\u003elayer_past\u003c/code\u003e from float to int8, and meanwhile the quantized \u003ccode\u003elayer-past\u003c/code\u003e will also store the quantization parameters.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSpecific steps are as follows:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eQuantize key/value\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\" qv,scale,zero_point=quantize_cache_v(v)\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e qv,scale,zero_point=quantize_cache_v(v)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003col start=\"2\" dir=\"auto\"\u003e\n\u003cli\u003eStore into layer_past\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eThe following is the format of quantized \u003ccode\u003elayer_past\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\" layer_past=((q_key,key_scale,key_zero_point),\n (q_value,value_scale,value_zero_point))\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e layer_past=((q_key,key_scale,key_zero_point),\n (q_value,value_scale,value_zero_point))\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe original format of \u003ccode\u003elayer_past\u003c/code\u003e is shown below:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\" layer_past=(key,value)\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e layer_past=(key,value)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you want to use the attention KV which is quantized, you can use the dequantization operation to convert the Int8 key/value back to the float format as follows:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\" v=dequantize_cache_torch(qv,scale,zero_point)\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e v=dequantize_cache_torch(qv,scale,zero_point)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInference Performance\u003c/h2\u003e\u003ca id=\"user-content-inference-performance\" class=\"anchor\" aria-label=\"Permalink: Inference Performance\" href=\"#inference-performance\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis section provides the statistics of speed and memory of models in different precisions. The speed and memory profiling are conducted using \u003ca href=\"https://qianwen-res.oss-cn-beijing.aliyuncs.com/profile.py\" rel=\"nofollow\"\u003ethis script\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe measured the average inference speed (tokens/s) and GPU memory usage of generating 2048 with the models in BF16, Int8, and Int4.\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003ctd\u003eModel Size\u003c/td\u003e\n \u003ctd\u003eQuantization\u003c/td\u003e\n \u003ctd\u003eSpeed (Tokens/s)\u003c/td\u003e\n \u003ctd\u003eGPU Memory Usage\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd rowspan=\"3\"\u003e1.8B\u003c/td\u003e\n \u003ctd\u003eBF16\u003c/td\u003e\n \u003ctd\u003e54.09\u003c/td\u003e\n \u003ctd\u003e4.23GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt8\u003c/td\u003e\n \u003ctd\u003e55.56\u003c/td\u003e\n \u003ctd\u003e3.48GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt4\u003c/td\u003e\n \u003ctd\u003e71.07\u003c/td\u003e\n \u003ctd\u003e2.91GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd rowspan=\"3\"\u003e7B\u003c/td\u003e\n \u003ctd\u003eBF16\u003c/td\u003e\n \u003ctd\u003e40.93\u003c/td\u003e\n \u003ctd\u003e16.99GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt8\u003c/td\u003e\n \u003ctd\u003e37.47\u003c/td\u003e\n \u003ctd\u003e11.20GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt4\u003c/td\u003e\n \u003ctd\u003e50.09\u003c/td\u003e\n \u003ctd\u003e8.21GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd rowspan=\"3\"\u003e14B\u003c/td\u003e\n \u003ctd\u003eBF16\u003c/td\u003e\n \u003ctd\u003e32.22\u003c/td\u003e\n \u003ctd\u003e30.15GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt8\u003c/td\u003e\n \u003ctd\u003e29.28\u003c/td\u003e\n \u003ctd\u003e18.81GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt4\u003c/td\u003e\n \u003ctd\u003e38.72\u003c/td\u003e\n \u003ctd\u003e13.01GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd rowspan=\"3\"\u003e72B\u003c/td\u003e\n \u003ctd\u003eBF16\u003c/td\u003e\n \u003ctd\u003e8.48\u003c/td\u003e\n \u003ctd\u003e144.69GB (2xA100)\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt8\u003c/td\u003e\n \u003ctd\u003e9.05\u003c/td\u003e\n \u003ctd\u003e81.27GB (2xA100)\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInt4\u003c/td\u003e\n \u003ctd\u003e11.32\u003c/td\u003e\n \u003ctd\u003e48.86GB\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e72B + vLLM\u003c/td\u003e\n \u003ctd\u003eBF16\u003c/td\u003e\n \u003ctd\u003e17.60\u003c/td\u003e\n \u003ctd\u003e2xA100\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eThe profiling runs on a single A100-SXM4-80G GPU (except 2xA100 is mentioned) with PyTorch 2.0.1, CUDA 11.8, and Flash-Attention 2. (72B + vLLM uses PyTorch 2.1.0 and Cuda 11.8.) The inference speed is averaged over the encoded and generated tokens.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eNote: The generation speed of the Int4/Int8 models mentioned above is provided by the autogptq library. The current speed of the model loaded using \u003ccode\u003eAutoModelForCausalLM.from_pretrained\u003c/code\u003e will be approximately 20% slower. We have reported this issue to the HuggingFace team and will update it promptly if a solution is available.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe also measure the inference speed and GPU memory usage with different settings of context and generation lengths, Flash-Attention version. You can find the results in the according modelcards on Hugging Face or ModelScope.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFinetuning\u003c/h2\u003e\u003ca id=\"user-content-finetuning\" class=\"anchor\" aria-label=\"Permalink: Finetuning\" href=\"#finetuning\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsage\u003c/h3\u003e\u003ca id=\"user-content-usage\" class=\"anchor\" aria-label=\"Permalink: Usage\" href=\"#usage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNow we provide the official training script, \u003ccode\u003efinetune.py\u003c/code\u003e, for users to finetune the pretrained model for downstream applications in a simple fashion. Additionally, we provide shell scripts to launch finetuning with no worries. This script supports the training with \u003ca href=\"https://github.com/microsoft/DeepSpeed\"\u003eDeepSpeed\u003c/a\u003e and \u003ca href=\"https://engineering.fb.com/2021/07/15/open-source/fsdp/\" rel=\"nofollow\"\u003eFSDP\u003c/a\u003e. The shell scripts that we provide use DeepSpeed (Note: this may have conflicts with the latest version of pydantic and you should use make sure \u003ccode\u003epydantic\u0026lt;2.0\u003c/code\u003e) and Peft. You can install them by:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install \u0026quot;peft\u0026lt;0.8.0\u0026quot; deepspeed\"\u003e\u003cpre\u003epip install \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003epeft\u0026lt;0.8.0\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e deepspeed\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo prepare your training data, you need to put all the samples into a list and save it to a json file. Each sample is a dictionary consisting of an id and a list for conversation. Below is a simple example list with 1 sample:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-json notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"[\n {\n \u0026quot;id\u0026quot;: \u0026quot;identity_0\u0026quot;,\n \u0026quot;conversations\u0026quot;: [\n {\n \u0026quot;from\u0026quot;: \u0026quot;user\u0026quot;,\n \u0026quot;value\u0026quot;: \u0026quot;你好\u0026quot;\n },\n {\n \u0026quot;from\u0026quot;: \u0026quot;assistant\u0026quot;,\n \u0026quot;value\u0026quot;: \u0026quot;我是一个语言模型,我叫通义千问。\u0026quot;\n }\n ]\n }\n]\"\u003e\u003cpre\u003e[\n {\n \u003cspan class=\"pl-ent\"\u003e\"id\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eidentity_0\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e,\n \u003cspan class=\"pl-ent\"\u003e\"conversations\"\u003c/span\u003e: [\n {\n \u003cspan class=\"pl-ent\"\u003e\"from\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003euser\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e,\n \u003cspan class=\"pl-ent\"\u003e\"value\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e你好\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\n },\n {\n \u003cspan class=\"pl-ent\"\u003e\"from\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eassistant\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e,\n \u003cspan class=\"pl-ent\"\u003e\"value\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e我是一个语言模型,我叫通义千问。\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\n }\n ]\n }\n]\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAfter data preparation, you can use the provided shell scripts to run finetuning. Remember to specify the path to the data file, \u003ccode\u003e$DATA\u003c/code\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe finetuning scripts allow you to perform:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFull-parameter finetuning\u003c/li\u003e\n\u003cli\u003eLoRA\u003c/li\u003e\n\u003cli\u003eQ-LoRA\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eFull-parameter finetuning requires updating all parameters in the whole training process. To launch your training, run the following script:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Distributed training. We do not provide single-GPU training script as the insufficient GPU memory will break down the training.\nbash finetune/finetune_ds.sh\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Distributed training. We do not provide single-GPU training script as the insufficient GPU memory will break down the training.\u003c/span\u003e\nbash finetune/finetune_ds.sh\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eRemember to specify the correct model name or path, the data path, as well as the output directory in the shell scripts. Another thing to notice is that we use DeepSpeed ZeRO 3 in this script. If you want to make changes, just remove the argument \u003ccode\u003e--deepspeed\u003c/code\u003e or make changes in the DeepSpeed configuration json file based on your requirements. Additionally, this script supports mixed-precision training, and thus you can use \u003ccode\u003e--bf16 True\u003c/code\u003e or \u003ccode\u003e--fp16 True\u003c/code\u003e. Remember to use DeepSpeed when you use fp16 due to mixed precision training. Empirically we advise you to use bf16 to make your training consistent with our pretraining and alignment if your machine supports bf16, and thus we use it by default.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSimilarly, to run LoRA, use another script to run as shown below. Before you start, make sure that you have installed \u003ccode\u003epeft\u003c/code\u003e. Also, you need to specify your paths to your model, data, and output. We advise you to use absolute path for your pretrained model. This is because LoRA only saves the adapter and the absolute path in the adapter configuration json file is used for finding out the pretrained model to load. Also, this script support both bf16 and fp16.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Single GPU training\nbash finetune/finetune_lora_single_gpu.sh\n# Distributed training\nbash finetune/finetune_lora_ds.sh\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Single GPU training\u003c/span\u003e\nbash finetune/finetune_lora_single_gpu.sh\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Distributed training\u003c/span\u003e\nbash finetune/finetune_lora_ds.sh\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn comparison with full-parameter finetuning, LoRA (\u003ca href=\"https://arxiv.org/abs/2106.09685\" rel=\"nofollow\"\u003epaper\u003c/a\u003e) only updates the parameters of adapter layers but keeps the original large language model layers frozen. This allows much fewer memory costs and thus fewer computation costs.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eNote that if you use LoRA to finetune the base language model, e.g., Qwen-7B, instead of chat models, e.g., Qwen-7B-Chat, the script automatically switches the embedding and output layer as trainable parameters. This is because the base language model has no knowledge of special tokens brought by ChatML format. Thus these layers should be updated for the model to understand and predict the tokens. Or in another word, if your training brings in special tokens in LoRA, you should set the layers to trainable parameters by setting \u003ccode\u003emodules_to_save\u003c/code\u003e inside the code. Also, if we have these parameters trainable, it is not available to use ZeRO 3, and this is why we use ZeRO 2 in the script by default. If you do not have new trainable parameters, you can switch to ZeRO 3 by changing the DeepSpeed configuration file. Additionally, we find that there is a significant gap between the memory footprint of LoRA with and without these trainable parameters. Therefore, if you have trouble with memory, we advise you to LoRA finetune the chat models. Check the profile below for more information.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you still suffer from insufficient memory, you can consider Q-LoRA (\u003ca href=\"https://arxiv.org/abs/2305.14314\" rel=\"nofollow\"\u003epaper\u003c/a\u003e), which uses the quantized large language model and other techniques such as paged attention to allow even fewer memory costs.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eNote: to run single-GPU Q-LoRA training, you may need to install \u003ccode\u003empi4py\u003c/code\u003e through \u003ccode\u003epip\u003c/code\u003e or \u003ccode\u003econda\u003c/code\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo run Q-LoRA, directly run the following script:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Single GPU training\nbash finetune/finetune_qlora_single_gpu.sh\n# Distributed training\nbash finetune/finetune_qlora_ds.sh\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Single GPU training\u003c/span\u003e\nbash finetune/finetune_qlora_single_gpu.sh\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Distributed training\u003c/span\u003e\nbash finetune/finetune_qlora_ds.sh\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor Q-LoRA, we advise you to load our provided quantized model, e.g., Qwen-7B-Chat-Int4. You \u003cstrong\u003eSHOULD NOT\u003c/strong\u003e use the bf16 models. Different from full-parameter finetuning and LoRA, only fp16 is supported for Q-LoRA. For single-GPU training, we have to use DeepSpeed for mixed-precision training due to our observation of errors caused by torch amp. Besides, for Q-LoRA, the troubles with the special tokens in LoRA still exist. However, as we only provide the Int4 models for chat models, which means the language model has learned the special tokens of ChatML format, you have no worry about the layers. Note that the layers of the Int4 model should not be trainable, and thus if you introduce special tokens in your training, Q-LoRA might not work.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eNOTE: Please be aware that due to the internal mechanisms of Hugging Face, certain non-Python files (e.g., \u003ccode\u003e*.cpp\u003c/code\u003e and \u003ccode\u003e*.cu\u003c/code\u003e)\nmay be missing from the saved checkpoint. You may need to manually copy them to the directory containing other files.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eDifferent from full-parameter finetuning, the training of both LoRA and Q-LoRA only saves the adapter parameters. Suppose your training starts from Qwen-7B, you can load the finetuned model for inference as shown below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from peft import AutoPeftModelForCausalLM\n\nmodel = AutoPeftModelForCausalLM.from_pretrained(\n path_to_adapter, # path to the output directory\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003epeft\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoPeftModelForCausalLM\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoPeftModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003epath_to_adapter\u003c/span\u003e, \u003cspan class=\"pl-c\"\u003e# path to the output directory\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\u003c/pre\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eNOTE: If \u003ccode\u003epeft\u0026gt;=0.8.0\u003c/code\u003e, it will try to load the tokenizer as well, however, initialized without \u003ccode\u003etrust_remote_code=True\u003c/code\u003e, leading to \u003ccode\u003eValueError: Tokenizer class QWenTokenizer does not exist or is not currently imported.\u003c/code\u003e Currently, you could downgrade \u003ccode\u003epeft\u0026lt;0.8.0\u003c/code\u003e or move tokenizer files elsewhere to workaround this issue.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eIf you want to merge the adapters and save the finetuned model as a standalone model (you can only do this with LoRA, and you CANNOT merge the parameters from Q-LoRA), you can run the following codes:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from peft import AutoPeftModelForCausalLM\n\nmodel = AutoPeftModelForCausalLM.from_pretrained(\n path_to_adapter, # path to the output directory\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\n\nmerged_model = model.merge_and_unload()\n# max_shard_size and safe serialization are not necessary. \n# They respectively work for sharding checkpoint and save the model to safetensors\nmerged_model.save_pretrained(new_model_directory, max_shard_size=\u0026quot;2048MB\u0026quot;, safe_serialization=True)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003epeft\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoPeftModelForCausalLM\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoPeftModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003epath_to_adapter\u003c/span\u003e, \u003cspan class=\"pl-c\"\u003e# path to the output directory\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\n\u003cspan class=\"pl-s1\"\u003emerged_model\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003emerge_and_unload\u003c/span\u003e()\n\u003cspan class=\"pl-c\"\u003e# max_shard_size and safe serialization are not necessary. \u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# They respectively work for sharding checkpoint and save the model to safetensors\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emerged_model\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003esave_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003enew_model_directory\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003emax_shard_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"2048MB\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003esafe_serialization\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe \u003ccode\u003enew_model_directory\u003c/code\u003e directory will contain the merged model weights and module files. Please note that \u003ccode\u003e*.cu\u003c/code\u003e and \u003ccode\u003e*.cpp\u003c/code\u003e files may be missing in the saved files. If you wish to use the KV cache functionality, please manually copy them. Besides, the tokenizer files are not saved in the new directory in this step. You can copy the tokenizer files or use the following code\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from transformers import AutoTokenizer\n\ntokenizer = AutoTokenizer.from_pretrained(\n path_to_adapter, # path to the output directory\n trust_remote_code=True\n)\n\ntokenizer.save_pretrained(new_model_directory)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003epath_to_adapter\u003c/span\u003e, \u003cspan class=\"pl-c\"\u003e# path to the output directory\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n)\n\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003esave_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003enew_model_directory\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNote: For multi-GPU training, you need to specify the proper hyperparameters for distributed training based on your machine. Besides, we advise you to specify your maximum sequence length with the argument \u003ccode\u003e--model_max_length\u003c/code\u003e, based on your consideration of data, memory footprint, and training speed.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuantize Fine-tuned Models\u003c/h3\u003e\u003ca id=\"user-content-quantize-fine-tuned-models\" class=\"anchor\" aria-label=\"Permalink: Quantize Fine-tuned Models\" href=\"#quantize-fine-tuned-models\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis section applies to full-parameter/LoRA fine-tuned models. (Note: You do not need to quantize the Q-LoRA fine-tuned model because it is already quantized.)\nIf you use LoRA, please follow the above instructions to merge your model before quantization.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe recommend using \u003ca href=\"https://github.com/PanQiWei/AutoGPTQ\"\u003eauto_gptq\u003c/a\u003e to quantize the finetuned model.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install auto-gptq optimum\"\u003e\u003cpre\u003epip install auto-gptq optimum\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNote: Currently AutoGPTQ has a bug referred in \u003ca href=\"https://github.com/PanQiWei/AutoGPTQ/issues/370\" data-hovercard-type=\"issue\" data-hovercard-url=\"/AutoGPTQ/AutoGPTQ/issues/370/hovercard\"\u003ethis issue\u003c/a\u003e. Here is a \u003ca href=\"https://github.com/PanQiWei/AutoGPTQ/pull/495\" data-hovercard-type=\"pull_request\" data-hovercard-url=\"/AutoGPTQ/AutoGPTQ/pull/495/hovercard\"\u003eworkaround PR\u003c/a\u003e, and you can pull this branch and install from the source.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFirst, prepare the calibration data. You can reuse the fine-tuning data, or use other data following the same format.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSecond, run the following script:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python run_gptq.py \\\n --model_name_or_path $YOUR_LORA_MODEL_PATH \\\n --data_path $DATA \\\n --out_path $OUTPUT_PATH \\\n --bits 4 # 4 for int4; 8 for int8\"\u003e\u003cpre\u003epython run_gptq.py \\\n --model_name_or_path \u003cspan class=\"pl-smi\"\u003e$YOUR_LORA_MODEL_PATH\u003c/span\u003e \\\n --data_path \u003cspan class=\"pl-smi\"\u003e$DATA\u003c/span\u003e \\\n --out_path \u003cspan class=\"pl-smi\"\u003e$OUTPUT_PATH\u003c/span\u003e \\\n --bits 4 \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e 4 for int4; 8 for int8\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis step requires GPUs and may costs a few hours according to your data size and model size.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThen, copy all \u003ccode\u003e*.py\u003c/code\u003e, \u003ccode\u003e*.cu\u003c/code\u003e, \u003ccode\u003e*.cpp\u003c/code\u003e files and \u003ccode\u003egeneration_config.json\u003c/code\u003e to the output path. And we recommend you to overwrite \u003ccode\u003econfig.json\u003c/code\u003e by copying the file from the coresponding official quantized model\n(for example, if you are fine-tuning \u003ccode\u003eQwen-7B-Chat\u003c/code\u003e and use \u003ccode\u003e--bits 4\u003c/code\u003e, you can find the \u003ccode\u003econfig.json\u003c/code\u003e from \u003ca href=\"https://huggingface.co/Qwen/Qwen-7B-Chat-Int4/blob/main/config.json\" rel=\"nofollow\"\u003eQwen-7B-Chat-Int4\u003c/a\u003e).\nYou should also rename the \u003ccode\u003egptq.safetensors\u003c/code\u003e into \u003ccode\u003emodel.safetensors\u003c/code\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFinally, test the model by the same method to load the official quantized model. For example,\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from transformers import AutoModelForCausalLM, AutoTokenizer\nfrom transformers.generation import GenerationConfig\n\ntokenizer = AutoTokenizer.from_pretrained(\u0026quot;/path/to/your/model\u0026quot;, trust_remote_code=True)\n\nmodel = AutoModelForCausalLM.from_pretrained(\n \u0026quot;/path/to/your/model\u0026quot;,\n device_map=\u0026quot;auto\u0026quot;,\n trust_remote_code=True\n).eval()\n\nresponse, history = model.chat(tokenizer, \u0026quot;你好\u0026quot;, history=None)\nprint(response)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etransformers\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003egeneration\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eGenerationConfig\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoTokenizer\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"/path/to/your/model\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eAutoModelForCausalLM\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003efrom_pretrained\u003c/span\u003e(\n \u003cspan class=\"pl-s\"\u003e\"/path/to/your/model\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003edevice_map\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"auto\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003etrust_remote_code\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e\n).\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e()\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etokenizer\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMultinode Finetuning\u003c/h3\u003e\u003ca id=\"user-content-multinode-finetuning\" class=\"anchor\" aria-label=\"Permalink: Multinode Finetuning\" href=\"#multinode-finetuning\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOur provided scripts support multinode finetuning. You can refer to the comments in \u003ca href=\"/QwenLM/Qwen/blob/main/finetune/finetune_lora_ds.sh\"\u003escript\u003c/a\u003e to correctly set corresponding arguments and launch the script on each node. For more information about multinode distributed training, please refer to \u003ca href=\"https://pytorch.org/docs/stable/elastic/run.html\" rel=\"nofollow\"\u003etorchrun\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eNote: DeepSpeed ZeRO 3 requires much greater inter-node communication rate than ZeRO 2, which will significantly reduce the training speed in the case of multinode finetuning. Therefore, we do not recommend using DeepSpeed ZeRO 3 configurations in multinode finetuning scripts.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eProfiling of Memory and Speed\u003c/h3\u003e\u003ca id=\"user-content-profiling-of-memory-and-speed\" class=\"anchor\" aria-label=\"Permalink: Profiling of Memory and Speed\" href=\"#profiling-of-memory-and-speed\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe profile the GPU memory and training speed of both LoRA (LoRA (emb) refers to training the embedding and output layer, while LoRA has no trainable embedding and output layer) and Q-LoRA in the setup of single-GPU training. In this test, we experiment on a single A100-SXM4-80G GPU, and we use CUDA 11.8 and Pytorch 2.0. Flash attention 2 is applied. We uniformly use a batch size of 1 and gradient accumulation of 8. We profile the memory (GB) and speed (s/iter) of inputs of different lengths, namely 256, 512, 1024, 2048, 4096, and 8192. We also report the statistics of full-parameter finetuning with Qwen-7B on 2 A100 GPUs. We only report the statistics of 256, 512, and 1024 tokens due to the limitation of GPU memory.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor Qwen-7B, we also test the performance of multinode finetuning. We experiment using two servers, each containing two A100-SXM4-80G GPUs, and the rest of configurations are the same as other Qwen-7B experiments. The results of multinode finetuning are marked as LoRA (multinode) in the table.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor Qwen-72B, we experiment in two ways: 1) Lora fintuning + DeepSpeed ZeRO 3 on 4 A100-SXM4-80G GPUs and 2) QLora (int4) fine-tuning on a single A100-SXM4-80G GPU. Note that OOM occurs on 4 A100-SXM4-80G GPUs both with LoRA (emb) fine-tuning and LoRA fine-tuning without Deepspeed ZeRO 3 (you can pass \u003ccode\u003e--deepspeed finetune/ds_config_zero3.json\u003c/code\u003e to \u003ca href=\"/QwenLM/Qwen/blob/main/finetune/finetune_lora_ds.sh\"\u003e\u003ccode\u003efinetune/finetune_lora_ds.sh\u003c/code\u003e\u003c/a\u003e to enable DeepSpeed ZeRO 3).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe statistics are listed below:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth rowspan=\"2\"\u003eModel Size\u003c/th\u003e\u003cth rowspan=\"2\"\u003eMethod\u003c/th\u003e\u003cth rowspan=\"2\"\u003e#Nodes\u003c/th\u003e\u003cth rowspan=\"2\"\u003e#GPUs per node\u003c/th\u003e\u003cth colspan=\"6\" align=\"center\"\u003eSequence Length\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth align=\"center\"\u003e256\u003c/th\u003e\u003cth align=\"center\"\u003e512\u003c/th\u003e\u003cth align=\"center\"\u003e1024\u003c/th\u003e\u003cth align=\"center\"\u003e2048\u003c/th\u003e\u003cth align=\"center\"\u003e4096\u003c/th\u003e\u003cth align=\"center\"\u003e8192\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth rowspan=\"4\"\u003e1.8B\u003c/th\u003e\u003ctd\u003eLoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e6.7G / 1.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e7.4G / 1.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e8.4G / 1.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e11.0G / 1.7s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e16.2G / 3.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e21.8G / 6.8s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eLoRA (emb)\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e13.7G / 1.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e14.0G / 1.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e14.0G / 1.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e15.1G / 1.8s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e19.7G / 3.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e27.7G / 7.0s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQ-LoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e5.8G / 1.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e6.0G / 1.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e6.6G / 1.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e7.8G / 2.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e10.2G / 3.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e15.8G / 6.5s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eFull-parameter\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e43.5G / 2.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e43.5G / 2.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e43.5G / 2.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e43.5G / 2.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e47.1G / 2.8s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e48.3G / 5.6s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth rowspan=\"5\"\u003e7B\u003c/th\u003e\n \u003ctd\u003eLoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e20.1G / 1.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e20.4G / 1.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e21.5G / 2.8s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e23.8G / 5.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e29.7G / 10.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e36.6G / 21.3s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eLoRA (emb)\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e33.7G / 1.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e34.1G / 1.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e35.2G / 2.9s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e35.1G / 5.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e39.2G / 10.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e48.5G / 21.7s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQ-LoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e11.5G / 3.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e11.5G / 3.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e12.3G / 3.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e13.9G / 7.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e16.9G / 11.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e23.5G / 22.3s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eFull-parameter\u003c/td\u003e\n\u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e2\u003c/td\u003e\n\u003ctd align=\"center\"\u003e139.2G / 4.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e148.0G / 4.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e162.0G / 4.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eLoRA (multinode)\u003c/td\u003e\n \u003ctd\u003e2\u003c/td\u003e\u003ctd\u003e2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e74.7G / 2.09s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e77.6G / 3.16s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e84.9G / 5.17s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e95.1G / 9.25s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e121.1G / 18.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e155.5G / 37.4s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth rowspan=\"3\"\u003e14B\u003c/th\u003e\n \u003ctd\u003eLoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e34.6G / 1.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e35.1G / 2.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e35.3G / 4.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e37.4G / 8.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e42.5G / 17.0s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e55.2G / 36.0s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eLoRA (emb)\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e51.2 / 1.7s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e51.1G / 2.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e51.5G / 4.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e54.1G / 8.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e56.8G / 17.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e67.7G / 36.3s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQ-LoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e18.7G / 5.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e18.4G / 6.3s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e18.9G / 8.2s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e19.9G / 11.8s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e23.0G / 20.1s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e27.9G / 38.3s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth rowspan=\"2\"\u003e72B\u003c/th\u003e\n \u003ctd\u003eLoRA + Deepspeed Zero3\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e4\u003c/td\u003e\n \u003ctd align=\"center\"\u003e215.4G / 17.6s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e217.7G / 20.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e222.6G / 29.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e228.8G / 45.7s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e249.0G / 83.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e289.2G / 161.5s/it\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQ-LoRA\u003c/td\u003e\n \u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e61.4G / 27.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e61.4G / 31.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e62.9G / 41.4s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e64.1G / 59.5s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e68.0G / 97.7s/it\u003c/td\u003e\u003ctd align=\"center\"\u003e75.6G / 179.8s/it\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDeployment\u003c/h2\u003e\u003ca id=\"user-content-deployment\" class=\"anchor\" aria-label=\"Permalink: Deployment\" href=\"#deployment\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003evLLM\u003c/h3\u003e\u003ca id=\"user-content-vllm\" class=\"anchor\" aria-label=\"Permalink: vLLM\" href=\"#vllm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor deployment and fast inference, we suggest using vLLM.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you use \u003cstrong\u003eCUDA 12.1 and PyTorch 2.1\u003c/strong\u003e, you can directly use the following command to install vLLM.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install vllm\"\u003e\u003cpre\u003epip install vllm\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOtherwise, please refer to the official vLLM \u003ca href=\"https://docs.vllm.ai/en/latest/getting_started/installation.html\" rel=\"nofollow\"\u003eInstallation Instructions\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003evLLM + Transformer-like Wrapper\u003c/h4\u003e\u003ca id=\"user-content-vllm--transformer-like-wrapper\" class=\"anchor\" aria-label=\"Permalink: vLLM + Transformer-like Wrapper\" href=\"#vllm--transformer-like-wrapper\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou can download the \u003ca href=\"/QwenLM/Qwen/blob/main/examples/vllm_wrapper.py\"\u003ewrapper codes\u003c/a\u003e and execute the following commands for multiple rounds of dialogue interaction. (Note: It currently only supports the \u003ccode\u003emodel.chat()\u003c/code\u003e method.)\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from vllm_wrapper import vLLMWrapper\n\nmodel = vLLMWrapper('Qwen/Qwen-7B-Chat', tensor_parallel_size=1)\n# model = vLLMWrapper('Qwen/Qwen-7B-Chat-Int4', tensor_parallel_size=1, dtype=\u0026quot;float16\u0026quot;)\n\nresponse, history = model.chat(query=\u0026quot;你好\u0026quot;, history=None)\nprint(response)\nresponse, history = model.chat(query=\u0026quot;给我讲一个年轻人奋斗创业最终取得成功的故事。\u0026quot;, history=history)\nprint(response)\nresponse, history = model.chat(query=\u0026quot;给这个故事起一个标题\u0026quot;, history=history)\nprint(response)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003evllm_wrapper\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003evLLMWrapper\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003evLLMWrapper\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'Qwen/Qwen-7B-Chat'\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003etensor_parallel_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# model = vLLMWrapper('Qwen/Qwen-7B-Chat-Int4', tensor_parallel_size=1, dtype=\"float16\")\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003equery\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003equery\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"给我讲一个年轻人奋斗创业最终取得成功的故事。\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echat\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003equery\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"给这个故事起一个标题\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehistory\u003c/span\u003e)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003evLLM + Web Demo / OpenAI-like API\u003c/h4\u003e\u003ca id=\"user-content-vllm--web-demo--openai-like-api\" class=\"anchor\" aria-label=\"Permalink: vLLM + Web Demo / OpenAI-like API\" href=\"#vllm--web-demo--openai-like-api\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou can use FastChat to lauch a web demo or an OpenAI API server. First, install FastChat:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install \u0026quot;fschat[model_worker,webui]\u0026quot;\"\u003e\u003cpre\u003epip install \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003efschat[model_worker,webui]\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo run Qwen with vLLM and FastChat, you need launch a controller by:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python -m fastchat.serve.controller\"\u003e\u003cpre\u003epython -m fastchat.serve.controller\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThen you can launch the model worker, which means loading your model for inference. For single GPU inference, you can directly run:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype bfloat16\n# python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype float16 # run int4 model\"\u003e\u003cpre\u003epython -m fastchat.serve.vllm_worker --model-path \u003cspan class=\"pl-smi\"\u003e$model_path\u003c/span\u003e --trust-remote-code --dtype bfloat16\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype float16 # run int4 model\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHowever, if you hope to run the model on multiple GPUs for faster inference or larger memory, you can use tensor parallelism supported by vLLM. Suppose you run the model on 4 GPUs, the command is shown below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype bfloat16\n# python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype float16 # run int4 model\"\u003e\u003cpre\u003epython -m fastchat.serve.vllm_worker --model-path \u003cspan class=\"pl-smi\"\u003e$model_path\u003c/span\u003e --trust-remote-code --tensor-parallel-size 4 --dtype bfloat16\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype float16 # run int4 model\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAfter launching your model worker, you can launch a:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWeb UI Demo\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python -m fastchat.serve.gradio_web_server\"\u003e\u003cpre\u003epython -m fastchat.serve.gradio_web_server\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eOpenAI API\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python -m fastchat.serve.openai_api_server --host localhost --port 8000\"\u003e\u003cpre\u003epython -m fastchat.serve.openai_api_server --host localhost --port 8000\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHowever, if you find it difficult to use vLLM and FastChat, you can try our provided simplest methods to deploy a web demo, CLI demo, and API.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWeb UI\u003c/h3\u003e\u003ca id=\"user-content-web-ui\" class=\"anchor\" aria-label=\"Permalink: Web UI\" href=\"#web-ui\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe provide code for users to build a web UI demo (thanks to @wysaid). Before you start, make sure you install the following packages:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"pip install -r requirements_web_demo.txt\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003epip install -r requirements_web_demo.txt\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThen run the command below and click on the generated link:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python web_demo.py\"\u003e\u003cpre\u003epython web_demo.py\u003c/pre\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n \u003cbr\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/web_demo.gif\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/web_demo.gif\" width=\"600\" data-animated-image=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n \u003cbr\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003c/p\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCLI Demo\u003c/h3\u003e\u003ca id=\"user-content-cli-demo\" class=\"anchor\" aria-label=\"Permalink: CLI Demo\" href=\"#cli-demo\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe provide a CLI demo example in \u003ccode\u003ecli_demo.py\u003c/code\u003e, which supports streaming output for the generation. Users can interact with Qwen-7B-Chat by inputting prompts, and the model returns model outputs in the streaming mode. Run the command below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python cli_demo.py\"\u003e\u003cpre\u003epython cli_demo.py\u003c/pre\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n \u003cbr\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/cli_demo.gif\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/cli_demo.gif\" width=\"600\" data-animated-image=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n \u003cbr\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003cbr\u003e\n\u003c/p\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAPI\u003c/h3\u003e\u003ca id=\"user-content-api\" class=\"anchor\" aria-label=\"Permalink: API\" href=\"#api\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe provide methods to deploy local API based on OpenAI API (thanks to @hanpenggit). Before you start, install the required packages:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"pip install fastapi uvicorn \u0026quot;openai\u0026lt;1.0\u0026quot; pydantic sse_starlette\"\u003e\u003cpre\u003epip install fastapi uvicorn \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eopenai\u0026lt;1.0\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e pydantic sse_starlette\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThen run the command to deploy your API:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"python openai_api.py\"\u003e\u003cpre\u003epython openai_api.py\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou can change your arguments, e.g., \u003ccode\u003e-c\u003c/code\u003e for checkpoint name or path, \u003ccode\u003e--cpu-only\u003c/code\u003e for CPU deployment, etc. If you meet problems launching your API deployment, updating the packages to the latest version can probably solve them.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eUsing the API is also simple. See the example below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import openai\nopenai.api_base = \u0026quot;http://localhost:8000/v1\u0026quot;\nopenai.api_key = \u0026quot;none\u0026quot;\n\n# create a request activating streaming response\nfor chunk in openai.ChatCompletion.create(\n model=\u0026quot;Qwen\u0026quot;,\n messages=[\n {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;你好\u0026quot;}\n ],\n stream=True \n # Specifying stop words in streaming output format is not yet supported and is under development.\n):\n if hasattr(chunk.choices[0].delta, \u0026quot;content\u0026quot;):\n print(chunk.choices[0].delta.content, end=\u0026quot;\u0026quot;, flush=True)\n\n# create a request not activating streaming response\nresponse = openai.ChatCompletion.create(\n model=\u0026quot;Qwen\u0026quot;,\n messages=[\n {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;你好\u0026quot;}\n ],\n stream=False,\n stop=[] # You can add custom stop words here, e.g., stop=[\u0026quot;Observation:\u0026quot;] for ReAct prompting.\n)\nprint(response.choices[0].message.content)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eopenai\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eopenai\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eapi_base\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"http://localhost:8000/v1\"\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eopenai\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eapi_key\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"none\"\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# create a request activating streaming response\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003echunk\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eopenai\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eChatCompletion\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecreate\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"Qwen\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003emessages\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e[\n {\u003cspan class=\"pl-s\"\u003e\"role\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\"user\"\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"content\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e}\n ],\n \u003cspan class=\"pl-s1\"\u003estream\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e \n \u003cspan class=\"pl-c\"\u003e# Specifying stop words in streaming output format is not yet supported and is under development.\u003c/span\u003e\n):\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ehasattr\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003echunk\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echoices\u003c/span\u003e[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e].\u003cspan class=\"pl-c1\"\u003edelta\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"content\"\u003c/span\u003e):\n \u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003echunk\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echoices\u003c/span\u003e[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e].\u003cspan class=\"pl-c1\"\u003edelta\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003econtent\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eend\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"\"\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eflush\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\n\u003cspan class=\"pl-c\"\u003e# create a request not activating streaming response\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eopenai\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eChatCompletion\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecreate\u003c/span\u003e(\n \u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\"Qwen\"\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003emessages\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e[\n {\u003cspan class=\"pl-s\"\u003e\"role\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\"user\"\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"content\"\u003c/span\u003e: \u003cspan class=\"pl-s\"\u003e\"你好\"\u003c/span\u003e}\n ],\n \u003cspan class=\"pl-s1\"\u003estream\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e,\n \u003cspan class=\"pl-s1\"\u003estop\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e[] \u003cspan class=\"pl-c\"\u003e# You can add custom stop words here, e.g., stop=[\"Observation:\"] for ReAct prompting.\u003c/span\u003e\n)\n\u003cspan class=\"pl-en\"\u003eprint\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eresponse\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003echoices\u003c/span\u003e[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e].\u003cspan class=\"pl-c1\"\u003emessage\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003econtent\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n \u003cbr\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/openai_api.gif\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/openai_api.gif\" width=\"600\" data-animated-image=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n \u003cbr\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\u003cstrong\u003eFunction calling\u003c/strong\u003e is also supported (but only when \u003ccode\u003estream=False\u003c/code\u003e for the moment). See the \u003ca href=\"/QwenLM/Qwen/blob/main/examples/function_call_examples.py\"\u003eexample usage\u003c/a\u003e here.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🐳 Docker\u003c/h2\u003e\u003ca id=\"user-content--docker\" class=\"anchor\" aria-label=\"Permalink: 🐳 Docker\" href=\"#-docker\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo simplify the deployment process, we provide docker images with pre-built environments: \u003ca href=\"https://hub.docker.com/r/qwenllm/qwen\" rel=\"nofollow\"\u003eqwenllm/qwen\u003c/a\u003e. You only need to install the driver and download model files to launch demos, deploy OpenAI API, and finetune the model.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePreparation\u003c/h3\u003e\u003ca id=\"user-content-preparation\" class=\"anchor\" aria-label=\"Permalink: Preparation\" href=\"#preparation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eInstall the correct version of Nvidia driver depending on the image to use:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eqwenllm/qwen:cu117\u003c/code\u003e (\u003cstrong\u003erecommend\u003c/strong\u003e): \u003ccode\u003e\u0026gt;= 515.48.07\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eqwenllm/qwen:cu114\u003c/code\u003e (w/o flash-attention): \u003ccode\u003e\u0026gt;= 470.82.01\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eqwenllm/qwen:cu121\u003c/code\u003e: \u003ccode\u003e\u0026gt;= 530.30.02\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eqwenllm/qwen:latest\u003c/code\u003e: same as \u003ccode\u003eqwenllm/qwen:cu117\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003col start=\"2\" dir=\"auto\"\u003e\n\u003cli\u003eInstall and configure \u003ca href=\"https://docs.docker.com/engine/install/\" rel=\"nofollow\"\u003edocker\u003c/a\u003e and \u003ca href=\"https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html\" rel=\"nofollow\"\u003envidia-container-toolkit\u003c/a\u003e:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# configure docker\nsudo systemctl start docker\n# test if docker is correctly installed\nsudo docker run hello-world\n\n# configure nvidia-container-toolkit\nsudo nvidia-ctk runtime configure --runtime=docker\nsudo systemctl restart docker\n# test if nvidia-container-toolkit is correctly installed\nsudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e configure docker\u003c/span\u003e\nsudo systemctl start docker\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e test if docker is correctly installed\u003c/span\u003e\nsudo docker run hello-world\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e configure nvidia-container-toolkit\u003c/span\u003e\nsudo nvidia-ctk runtime configure --runtime=docker\nsudo systemctl restart docker\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e test if nvidia-container-toolkit is correctly installed\u003c/span\u003e\nsudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi\u003c/pre\u003e\u003c/div\u003e\n\u003col start=\"3\" dir=\"auto\"\u003e\n\u003cli\u003eDownload model checkpoints and codes to your environment (see \u003ca href=\"#DownloadModel\"\u003ehere\u003c/a\u003e).\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDeployment\u003c/h3\u003e\u003ca id=\"user-content-deployment-1\" class=\"anchor\" aria-label=\"Permalink: Deployment\" href=\"#deployment-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHere we use Qwen-7B-Chat as an example. Before launching a web demo or API, you can setup the configuration as shown below:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"IMAGE_NAME=qwenllm/qwen:cu117\nPORT=8901\nCHECKPOINT_PATH=/path/to/Qwen-7B-Chat # Path to downloaded model checkpoints and codes\"\u003e\u003cpre\u003eIMAGE_NAME=qwenllm/qwen:cu117\nPORT=8901\nCHECKPOINT_PATH=/path/to/Qwen-7B-Chat \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Path to downloaded model checkpoints and codes\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe following scripts can help you build:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eOpenAI API\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"bash docker/docker_openai_api.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH} --port ${PORT}\"\u003e\u003cpre\u003ebash docker/docker_openai_api.sh -i \u003cspan class=\"pl-smi\"\u003e${IMAGE_NAME}\u003c/span\u003e -c \u003cspan class=\"pl-smi\"\u003e${CHECKPOINT_PATH}\u003c/span\u003e --port \u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWeb UI\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"bash docker/docker_web_demo.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH} --port ${PORT}\"\u003e\u003cpre\u003ebash docker/docker_web_demo.sh -i \u003cspan class=\"pl-smi\"\u003e${IMAGE_NAME}\u003c/span\u003e -c \u003cspan class=\"pl-smi\"\u003e${CHECKPOINT_PATH}\u003c/span\u003e --port \u003cspan class=\"pl-smi\"\u003e${PORT}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eCLI Demo\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"bash docker/docker_cli_demo.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH}\"\u003e\u003cpre\u003ebash docker/docker_cli_demo.sh -i \u003cspan class=\"pl-smi\"\u003e${IMAGE_NAME}\u003c/span\u003e -c \u003cspan class=\"pl-smi\"\u003e${CHECKPOINT_PATH}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe commands above will automatically download the required image and launch a Web UI demo in background (the service will auto-restart). You can open \u003ccode\u003ehttp://localhost:${PORT}\u003c/code\u003e on the host to use the demo.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe demo is successfully launched if you see the following output:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"Successfully started web demo. Open '...' to try!\nRun `docker logs ...` to check demo status.\nRun `docker rm -f ...` to stop and remove the demo.\"\u003e\u003cpre lang=\"text\" class=\"notranslate\"\u003e\u003ccode\u003eSuccessfully started web demo. Open '...' to try!\nRun `docker logs ...` to check demo status.\nRun `docker rm -f ...` to stop and remove the demo.\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you want to check the status of the demo, you can use \u003ccode\u003edocker logs qwen\u003c/code\u003e to display outputs.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou can use \u003ccode\u003edocker rm -f qwen\u003c/code\u003e to stop the service and remove the container.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFinetuning\u003c/h3\u003e\u003ca id=\"user-content-finetuning-1\" class=\"anchor\" aria-label=\"Permalink: Finetuning\" href=\"#finetuning-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe method of finetuning using the pre-built Docker image is basically the same as \u003ca href=\"#Finetuning\"\u003ethe above chapter\u003c/a\u003e (we have already installed dependencies in the image):\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe following is an example of single-GPU LoRA:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"IMAGE_NAME=qwenllm/qwen:cu117\nCHECKPOINT_PATH=/path/to/Qwen-7B # Path to downloaded model checkpoints and codes\n#CHECKPOINT_PATH=/path/to/Qwen-7B-Chat-Int4 # Path to downloaded model checkpoints and codes (Q-LoRA)\nDATA_PATH=/path/to/data/root # Prepare finetune data at ${DATA_PATH}/example.json\nOUTPUT_PATH=/path/to/output/checkpoint # Path to finetune outputs\n\n# Use all host devices by default\nDEVICE=all\n# If you need to specify GPUs for training, set device as follow (NOTE: internal quotation marks cannot be omitted)\n#DEVICE='\u0026quot;device=0,1,2,3\u0026quot;'\n\nmkdir -p ${OUTPUT_PATH}\n\n# Single-GPU LoRA finetuning\ndocker run --gpus ${DEVICE} --rm --name qwen \\\n --mount type=bind,source=${CHECKPOINT_PATH},target=/data/shared/Qwen/Qwen-7B \\\n --mount type=bind,source=${DATA_PATH},target=/data/shared/Qwen/data \\\n --mount type=bind,source=${OUTPUT_PATH},target=/data/shared/Qwen/output_qwen \\\n --shm-size=2gb \\\n -it ${IMAGE_NAME} \\\n bash finetune/finetune_lora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B/ -d /data/shared/Qwen/data/example.json\"\u003e\u003cpre\u003eIMAGE_NAME=qwenllm/qwen:cu117\nCHECKPOINT_PATH=/path/to/Qwen-7B \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Path to downloaded model checkpoints and codes\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003eCHECKPOINT_PATH=/path/to/Qwen-7B-Chat-Int4 # Path to downloaded model checkpoints and codes (Q-LoRA)\u003c/span\u003e\nDATA_PATH=/path/to/data/root \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Prepare finetune data at ${DATA_PATH}/example.json\u003c/span\u003e\nOUTPUT_PATH=/path/to/output/checkpoint \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Path to finetune outputs\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Use all host devices by default\u003c/span\u003e\nDEVICE=all\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e If you need to specify GPUs for training, set device as follow (NOTE: internal quotation marks cannot be omitted)\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003eDEVICE='\"device=0,1,2,3\"'\u003c/span\u003e\n\nmkdir -p \u003cspan class=\"pl-smi\"\u003e${OUTPUT_PATH}\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Single-GPU LoRA finetuning\u003c/span\u003e\ndocker run --gpus \u003cspan class=\"pl-smi\"\u003e${DEVICE}\u003c/span\u003e --rm --name qwen \\\n --mount type=bind,source=\u003cspan class=\"pl-smi\"\u003e${CHECKPOINT_PATH}\u003c/span\u003e,target=/data/shared/Qwen/Qwen-7B \\\n --mount type=bind,source=\u003cspan class=\"pl-smi\"\u003e${DATA_PATH}\u003c/span\u003e,target=/data/shared/Qwen/data \\\n --mount type=bind,source=\u003cspan class=\"pl-smi\"\u003e${OUTPUT_PATH}\u003c/span\u003e,target=/data/shared/Qwen/output_qwen \\\n --shm-size=2gb \\\n -it \u003cspan class=\"pl-smi\"\u003e${IMAGE_NAME}\u003c/span\u003e \\\n bash finetune/finetune_lora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B/ -d /data/shared/Qwen/data/example.json\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo make a change to single-GPU Q-LoRA for example, you just need to modify the bash command inside \u003ccode\u003edocker run\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"bash finetune/finetune_qlora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B-Chat-Int4/ -d /data/shared/Qwen/data/example.json\"\u003e\u003cpre\u003ebash finetune/finetune_qlora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B-Chat-Int4/ -d /data/shared/Qwen/data/example.json\u003c/pre\u003e\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🔥 System Prompt\u003c/h2\u003e\u003ca id=\"user-content--system-prompt\" class=\"anchor\" aria-label=\"Permalink: 🔥 System Prompt\" href=\"#-system-prompt\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eQwen-1.8-Chat and Qwen-72B-Chat have been fully trained on diverse system prompts with multiple rounds of complex interactions, so that they can follow a variety of system prompts and realize model customization in context, further improving the scalability of Qwen-chat.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWith System Prompt, Qwen-Chat can realize \u003cstrong\u003eroly playing\u003c/strong\u003e, \u003cstrong\u003elanguage style transfer\u003c/strong\u003e, \u003cstrong\u003etask setting\u003c/strong\u003e, and \u003cstrong\u003ebehavior setting\u003c/strong\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/system_prompt_language_style.png\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/system_prompt_language_style.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/system_prompt_role_play_en.png\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/system_prompt_role_play_en.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor more information, please refer to the \u003ca href=\"/QwenLM/Qwen/blob/main/examples/system_prompt.md\"\u003eexample documentation\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTool Usage\u003c/h2\u003e\u003ca id=\"user-content-tool-usage\" class=\"anchor\" aria-label=\"Permalink: Tool Usage\" href=\"#tool-usage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eQwen-Chat has been optimized for tool usage and function calling capabilities. Users can develop agents, LangChain applications, and even augment Qwen with a Python Code Interpreter.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe provide documentation on how to implement tool calls based on the principle of ReAct Prompting, please refer to \u003ca href=\"/QwenLM/Qwen/blob/main/examples/react_prompt.md\"\u003ethe ReAct example\u003c/a\u003e. Based on this principle, we provide support for function calling in \u003ca href=\"/QwenLM/Qwen/blob/main/openai_api.py\"\u003eopenai_api.py\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe have tested the model's tool calling capabilities on our open-source Chinese evaluation benchmark and found that Qwen-Chat consistently performs well:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth colspan=\"4\" align=\"center\"\u003eChinese Tool-Use Benchmark (Version 20231206)\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth align=\"center\"\u003eModel\u003c/th\u003e\u003cth align=\"center\"\u003eTool Selection (Acc.↑)\u003c/th\u003e\u003cth align=\"center\"\u003eTool Input (Rouge-L↑)\u003c/th\u003e\u003cth align=\"center\"\u003eFalse Positive Error↓\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eGPT-4\u003c/td\u003e\u003ctd align=\"center\"\u003e98.0%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.953\u003c/td\u003e\u003ctd align=\"center\"\u003e23.9%\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eGPT-3.5\u003c/td\u003e\u003ctd align=\"center\"\u003e74.5%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.807\u003c/td\u003e\u003ctd align=\"center\"\u003e80.6%\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-1_8B-Chat\u003c/td\u003e\u003ctd align=\"center\"\u003e85.0%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.839\u003c/td\u003e\u003ctd align=\"center\"\u003e27.6%\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-7B-Chat\u003c/td\u003e\u003ctd align=\"center\"\u003e95.5%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.900\u003c/td\u003e\u003ctd align=\"center\"\u003e11.6%\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-14B-Chat\u003c/td\u003e\u003ctd align=\"center\"\u003e96.9%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.917\u003c/td\u003e\u003ctd align=\"center\"\u003e5.6%\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-72B-Chat\u003c/td\u003e\u003ctd align=\"center\"\u003e98.2%\u003c/td\u003e\u003ctd align=\"center\"\u003e0.927\u003c/td\u003e\u003ctd align=\"center\"\u003e1.1%\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eTo assess Qwen's ability to use the Python Code Interpreter for tasks such as mathematical problem solving, data visualization, and other general-purpose tasks such as file handling and web scraping, we have created and open-sourced a benchmark specifically designed for evaluating these capabilities. You can find the benchmark at this \u003ca href=\"https://github.com/QwenLM/Qwen-Agent/tree/main/benchmark\"\u003elink\u003c/a\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe have observed that Qwen performs well in terms of code executability and result accuracy when generating code:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth colspan=\"5\" align=\"center\"\u003eCode Interpreter Benchmark (Version 20231206)\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth rowspan=\"2\" align=\"center\"\u003eModel\u003c/th\u003e\n \u003cth colspan=\"3\" align=\"center\"\u003eAccuracy of Code Execution Results (%)\u003c/th\u003e\n \u003cth colspan=\"1\" align=\"center\"\u003eExecutable Rate of Code (%)\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth align=\"center\"\u003eMath↑\u003c/th\u003e\u003cth align=\"center\"\u003eVisualization-Hard↑\u003c/th\u003e\u003cth align=\"center\"\u003eVisualization-Easy↑\u003c/th\u003e\u003cth align=\"center\"\u003eGeneral↑\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eGPT-4\u003c/td\u003e\n \u003ctd align=\"center\"\u003e82.8\u003c/td\u003e\n \u003ctd align=\"center\"\u003e66.7\u003c/td\u003e\n \u003ctd align=\"center\"\u003e60.8\u003c/td\u003e\n \u003ctd align=\"center\"\u003e82.8\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eGPT-3.5\u003c/td\u003e\n \u003ctd align=\"center\"\u003e47.3\u003c/td\u003e\n \u003ctd align=\"center\"\u003e33.3\u003c/td\u003e\n \u003ctd align=\"center\"\u003e55.7\u003c/td\u003e\n \u003ctd align=\"center\"\u003e74.1\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eLLaMA2-13B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e8.3\u003c/td\u003e\n \u003ctd align=\"center\"\u003e1.2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e15.2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e48.3\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eCodeLLaMA-13B-Instruct\u003c/td\u003e\n \u003ctd align=\"center\"\u003e28.2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e15.5\u003c/td\u003e\n \u003ctd align=\"center\"\u003e21.5\u003c/td\u003e\n \u003ctd align=\"center\"\u003e74.1\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eInternLM-20B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e34.6\u003c/td\u003e\n \u003ctd align=\"center\"\u003e10.7\u003c/td\u003e\n \u003ctd align=\"center\"\u003e25.1\u003c/td\u003e\n \u003ctd align=\"center\"\u003e65.5\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eChatGLM3-6B\u003c/td\u003e\n \u003ctd align=\"center\"\u003e54.2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e4.8\u003c/td\u003e\n \u003ctd align=\"center\"\u003e15.2\u003c/td\u003e\n \u003ctd align=\"center\"\u003e67.1\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-1.8B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e25.6\u003c/td\u003e\n \u003ctd align=\"center\"\u003e21.4\u003c/td\u003e\n \u003ctd align=\"center\"\u003e22.8\u003c/td\u003e\n \u003ctd align=\"center\"\u003e65.5\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-7B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e41.9\u003c/td\u003e\n \u003ctd align=\"center\"\u003e23.8\u003c/td\u003e\n \u003ctd align=\"center\"\u003e38.0\u003c/td\u003e\n \u003ctd align=\"center\"\u003e67.2\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-14B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e58.4\u003c/td\u003e\n \u003ctd align=\"center\"\u003e31.0\u003c/td\u003e\n \u003ctd align=\"center\"\u003e45.6\u003c/td\u003e\n \u003ctd align=\"center\"\u003e65.5\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-72B-Chat\u003c/td\u003e\n \u003ctd align=\"center\"\u003e72.7\u003c/td\u003e\n \u003ctd align=\"center\"\u003e41.7\u003c/td\u003e\n \u003ctd align=\"center\"\u003e43.0\u003c/td\u003e\n \u003ctd align=\"center\"\u003e82.8\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n \u003cbr\u003e\n \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/code_interpreter_showcase_001.jpg\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/code_interpreter_showcase_001.jpg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n \u003cbr\u003e\n\u003c/p\u003e\u003cp dir=\"auto\"\u003e\n\u003cbr\u003e\n\u003c/p\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLong-Context Understanding\u003c/h2\u003e\u003ca id=\"user-content-long-context-understanding\" class=\"anchor\" aria-label=\"Permalink: Long-Context Understanding\" href=\"#long-context-understanding\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo extend the context length and break the bottleneck of training sequence length, we introduce several techniques, including NTK-aware interpolation, window attention, and LogN attention scaling, to extend the context length of Qwen-14B from 2K to over 8K tokens, and Qwen-1.8B/7B from 8K to 32K tokens.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor Qwen-72B, we adapt RoPE to longer contexts with a larger rotary base. Qwen-72B supports the max context length of 32K tokens.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe conduct language modeling experiments on the arXiv dataset with the PPL evaluation and find that Qwen can reach outstanding performance in the scenario of long context. Results are demonstrated below:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth rowspan=\"2\"\u003eModel\u003c/th\u003e\u003cth colspan=\"6\" align=\"center\"\u003eSequence Length\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003cth align=\"center\"\u003e1024\u003c/th\u003e\u003cth align=\"center\"\u003e2048\u003c/th\u003e\u003cth align=\"center\"\u003e4096\u003c/th\u003e\u003cth align=\"center\"\u003e8192\u003c/th\u003e\u003cth align=\"center\"\u003e16384\u003c/th\u003e\u003cth align=\"center\"\u003e32768\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-7B (original)\u003c/td\u003e\u003ctd align=\"center\"\u003e4.23\u003c/td\u003e\u003ctd align=\"center\"\u003e3.78\u003c/td\u003e\u003ctd align=\"center\"\u003e39.35\u003c/td\u003e\u003ctd align=\"center\"\u003e469.81\u003c/td\u003e\u003ctd align=\"center\"\u003e2645.09\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk\u003c/td\u003e\u003ctd align=\"center\"\u003e4.23\u003c/td\u003e\u003ctd align=\"center\"\u003e3.78\u003c/td\u003e\u003ctd align=\"center\"\u003e3.59\u003c/td\u003e\u003ctd align=\"center\"\u003e3.66\u003c/td\u003e\u003ctd align=\"center\"\u003e5.71\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk + logn\u003c/td\u003e\u003ctd align=\"center\"\u003e4.23\u003c/td\u003e\u003ctd align=\"center\"\u003e3.78\u003c/td\u003e\u003ctd align=\"center\"\u003e3.58\u003c/td\u003e\u003ctd align=\"center\"\u003e3.56\u003c/td\u003e\u003ctd align=\"center\"\u003e4.62\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk + logn + window_attn\u003c/td\u003e\u003ctd align=\"center\"\u003e4.23\u003c/td\u003e\u003ctd align=\"center\"\u003e3.78\u003c/td\u003e\u003ctd align=\"center\"\u003e3.58\u003c/td\u003e\u003ctd align=\"center\"\u003e3.49\u003c/td\u003e\u003ctd align=\"center\"\u003e4.32\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003eQwen-1.8B\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e5.00\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.48\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.13\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.89\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e17.42\u003c/td\u003e\u003ctd align=\"center\"\u003e433.85\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk + logn + window_attn\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e5.00\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.48\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.14\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.93\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.82\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.83\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-7B\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.23\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.81\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.52\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.31\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e7.27\u003c/td\u003e\u003ctd align=\"center\"\u003e181.49\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk + logn + window_attn\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e4.23\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.81\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.52\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.33\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.22\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.17\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-14B\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e-\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.46\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e22.79\u003c/td\u003e\u003ctd align=\"center\"\u003e334.65\u003c/td\u003e\u003ctd align=\"center\"\u003e3168.35\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e+ dynamic_ntk + logn + window_attn\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e-\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.46\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.29\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e3.18\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e3.42\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003eQwen-72B\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e-\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e-\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e-\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e2.83\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e2.73\u003c/b\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003cb\u003e2.72\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \n\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eFurthermore, to verify the ability of Qwen-72B-Chat on long text understanding, we tested it on \u003ca href=\"https://arxiv.org/abs/2307.11088\" rel=\"nofollow\"\u003eL-Eval\u003c/a\u003e (closed-ended tasks). The results are as follows:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth align=\"left\"\u003eModel\u003c/th\u003e\n\u003cth align=\"center\"\u003eInput Length\u003c/th\u003e\n\u003cth align=\"center\"\u003eAverage\u003c/th\u003e\n\u003cth align=\"center\"\u003eCoursera\u003c/th\u003e\n\u003cth align=\"center\"\u003eGSM\u003c/th\u003e\n\u003cth align=\"center\"\u003eQuALITY\u003c/th\u003e\n\u003cth align=\"center\"\u003eTOEFL\u003c/th\u003e\n\u003cth align=\"center\"\u003eCodeU\u003c/th\u003e\n\u003cth align=\"center\"\u003eSFcition\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003eChatGPT-3.5-16k\u003c/td\u003e\n\u003ctd align=\"center\"\u003e16K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e60.73\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e63.51\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e84.00\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e61.38\u003c/td\u003e\n\u003ctd align=\"center\"\u003e78.43\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e12.22\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e64.84\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"left\"\u003e\u003cstrong\u003eQwen-72B-Chat\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e32K\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e62.30\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e58.13\u003c/td\u003e\n\u003ctd align=\"center\"\u003e76.00\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e77.22\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e86.24\u003c/strong\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e6.66\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003cstrong\u003e69.53\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eWe conducted the \"needle in a haystack\" experiment (the idea came from \u003ca href=\"https://twitter.com/GregKamradt/status/1727018183608193393\" rel=\"nofollow\"\u003e@Greg Kamradt\u003c/a\u003e) to test whether the model can retrieve information at different positions in the inputs of different lengths, the result is as follows:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/QwenLM/Qwen/blob/main/assets/qwen_72b_needle_in_a_haystack.png\"\u003e\u003cimg src=\"/QwenLM/Qwen/raw/main/assets/qwen_72b_needle_in_a_haystack.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe above results show that Qwen-72B-Chat can accurately retrieve information placed in various positions within an input length of 32k, proving its excellent long text understanding capabilities.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTokenizer\u003c/h2\u003e\u003ca id=\"user-content-tokenizer\" class=\"anchor\" aria-label=\"Permalink: Tokenizer\" href=\"#tokenizer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOur tokenizer based on tiktoken is different from other tokenizers, e.g., sentencepiece tokenizer. You need to pay attention to special tokens, especially in finetuning. For more detailed information on the tokenizer and related use in fine-tuning, please refer to the \u003ca href=\"/QwenLM/Qwen/blob/main/tokenization_note.md\"\u003edocumentation\u003c/a\u003e.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eReproduction\u003c/h2\u003e\u003ca id=\"user-content-reproduction\" class=\"anchor\" aria-label=\"Permalink: Reproduction\" href=\"#reproduction\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor your reproduction of the model performance on benchmark datasets, we provide scripts for you to reproduce the results. Check \u003ca href=\"/QwenLM/Qwen/blob/main/eval/EVALUATION.md\"\u003eeval/EVALUATION.md\u003c/a\u003e for more information. Note that the reproduction may lead to slight differences from our reported results.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFAQ\u003c/h2\u003e\u003ca id=\"user-content-faq\" class=\"anchor\" aria-label=\"Permalink: FAQ\" href=\"#faq\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you meet problems, please refer to \u003ca href=\"/QwenLM/Qwen/blob/main/FAQ.md\"\u003eFAQ\u003c/a\u003e and the issues first to search a solution before you launch a new issue.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCitation\u003c/h2\u003e\u003ca id=\"user-content-citation\" class=\"anchor\" aria-label=\"Permalink: Citation\" href=\"#citation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you find our work helpful, feel free to give us a cite.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"@article{qwen,\n title={Qwen Technical Report},\n author={Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu},\n journal={arXiv preprint arXiv:2309.16609},\n year={2023}\n}\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e@article{qwen,\n title={Qwen Technical Report},\n author={Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu},\n journal={arXiv preprint arXiv:2309.16609},\n year={2023}\n}\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cbr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLicense Agreement\u003c/h2\u003e\u003ca id=\"user-content-license-agreement\" class=\"anchor\" aria-label=\"Permalink: License Agreement\" href=\"#license-agreement\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe source code provided at \u003ca href=\"https://github.com/QwenLM/Qwen\"\u003ehttps://github.com/QwenLM/Qwen\u003c/a\u003e is licensed under the \u003ca href=\"/QwenLM/Qwen/blob/main/LICENSE\"\u003eApache 2.0 License\u003c/a\u003e that can be found at the root directory.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eResearchers and developers are free to use the codes and model weights of both Qwen and Qwen-Chat. For their commercial use, please check the License Agreement accompanying each model.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eQwen-72B, Qwen-14B, and Qwen-7B are licensed under the \u003ca href=\"/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT\"\u003eTongyi Qianwen LICENSE AGREEMENT\u003c/a\u003e that can be found at the corresponding HuggingFace and ModelScope repository. For commercial use, please fill out the form (\u003ca href=\"https://dashscope.console.aliyun.com/openModelApply/Qwen-72B-Chat\" rel=\"nofollow\"\u003e72B\u003c/a\u003e, \u003ca href=\"https://dashscope.console.aliyun.com/openModelApply/Qwen-14B-Chat\" rel=\"nofollow\"\u003e14B\u003c/a\u003e, and \u003ca href=\"https://dashscope.console.aliyun.com/openModelApply/qianwen\" rel=\"nofollow\"\u003e7B\u003c/a\u003e) to apply.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eQwen-1.8B is licensed under the \u003ca href=\"/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20RESEARCH%20LICENSE%20AGREEMENT\"\u003eTongyi Qianwen RESEARCH LICENSE AGREEMENT\u003c/a\u003e that can be found at the corresponding HuggingFace and ModelScope repository. For commercial use, please contact us.\n\u003cbr\u003e\u003cbr\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eContact Us\u003c/h2\u003e\u003ca id=\"user-content-contact-us\" class=\"anchor\" aria-label=\"Permalink: Contact Us\" href=\"#contact-us\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you are interested to leave a message to either our research team or product team, join our Discord or WeChat groups! Also, feel free to send an email to \u003ca href=\"mailto:qianwen_opensource@alibabacloud.com\"\u003eqianwen_opensource@alibabacloud.com\u003c/a\u003e.\u003c/p\u003e\n\u003c/article\u003e","loaded":true,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":[{"level":2,"text":"News and Updates","anchor":"news-and-updates","htmlText":"News and Updates"},{"level":2,"text":"Performance","anchor":"performance","htmlText":"Performance"},{"level":2,"text":"Requirements","anchor":"requirements","htmlText":"Requirements"},{"level":2,"text":"Quickstart","anchor":"quickstart","htmlText":"Quickstart"},{"level":3,"text":"🤗 Transformers","anchor":"-transformers","htmlText":"🤗 Transformers"},{"level":3,"text":"🤖 ModelScope","anchor":"-modelscope","htmlText":"🤖 ModelScope"},{"level":3,"text":"Batch Inference","anchor":"batch-inference","htmlText":"Batch Inference"},{"level":3,"text":"CPU","anchor":"cpu","htmlText":"CPU"},{"level":3,"text":"Multiple GPUs","anchor":"multiple-gpus","htmlText":"Multiple GPUs"},{"level":3,"text":"x86 Platforms","anchor":"x86-platforms","htmlText":"x86 Platforms"},{"level":3,"text":"DashScope","anchor":"dashscope","htmlText":"DashScope"},{"level":2,"text":"Quantization","anchor":"quantization","htmlText":"Quantization"},{"level":3,"text":"GPTQ","anchor":"gptq","htmlText":"GPTQ"},{"level":3,"text":"Quantization of KV cache","anchor":"quantization-of-kv-cache","htmlText":"Quantization of KV cache"},{"level":2,"text":"Inference Performance","anchor":"inference-performance","htmlText":"Inference Performance"},{"level":2,"text":"Finetuning","anchor":"finetuning","htmlText":"Finetuning"},{"level":3,"text":"Usage","anchor":"usage","htmlText":"Usage"},{"level":3,"text":"Quantize Fine-tuned Models","anchor":"quantize-fine-tuned-models","htmlText":"Quantize Fine-tuned Models"},{"level":3,"text":"Multinode Finetuning","anchor":"multinode-finetuning","htmlText":"Multinode Finetuning"},{"level":3,"text":"Profiling of Memory and Speed","anchor":"profiling-of-memory-and-speed","htmlText":"Profiling of Memory and Speed"},{"level":2,"text":"Deployment","anchor":"deployment","htmlText":"Deployment"},{"level":3,"text":"vLLM","anchor":"vllm","htmlText":"vLLM"},{"level":4,"text":"vLLM + Transformer-like Wrapper","anchor":"vllm--transformer-like-wrapper","htmlText":"vLLM + Transformer-like Wrapper"},{"level":4,"text":"vLLM + Web Demo / OpenAI-like API","anchor":"vllm--web-demo--openai-like-api","htmlText":"vLLM + Web Demo / OpenAI-like API"},{"level":3,"text":"Web UI","anchor":"web-ui","htmlText":"Web UI"},{"level":3,"text":"CLI Demo","anchor":"cli-demo","htmlText":"CLI Demo"},{"level":3,"text":"API","anchor":"api","htmlText":"API"},{"level":2,"text":"🐳 Docker","anchor":"-docker","htmlText":"🐳 Docker"},{"level":3,"text":"Preparation","anchor":"preparation","htmlText":"Preparation"},{"level":3,"text":"Deployment","anchor":"deployment-1","htmlText":"Deployment"},{"level":3,"text":"Finetuning","anchor":"finetuning-1","htmlText":"Finetuning"},{"level":2,"text":"🔥 System Prompt","anchor":"-system-prompt","htmlText":"🔥 System Prompt"},{"level":2,"text":"Tool Usage","anchor":"tool-usage","htmlText":"Tool Usage"},{"level":2,"text":"Long-Context Understanding","anchor":"long-context-understanding","htmlText":"Long-Context Understanding"},{"level":2,"text":"Tokenizer","anchor":"tokenizer","htmlText":"Tokenizer"},{"level":2,"text":"Reproduction","anchor":"reproduction","htmlText":"Reproduction"},{"level":2,"text":"FAQ","anchor":"faq","htmlText":"FAQ"},{"level":2,"text":"Citation","anchor":"citation","htmlText":"Citation"},{"level":2,"text":"License Agreement","anchor":"license-agreement","htmlText":"License Agreement"},{"level":2,"text":"Contact Us","anchor":"contact-us","htmlText":"Contact Us"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen"}},{"displayName":"LICENSE","repoName":"Qwen","refName":"main","path":"LICENSE","preferredFileType":"license","tabName":"Apache-2.0","richText":null,"loaded":false,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":null,"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen"}}],"overviewFilesProcessingTime":0}},"appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-9f8a877aa99f.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-96e76d5fdb2c.js","githubDevUrl":null,"enabled_features":{"copilot_workspace":null,"code_nav_ui_events":false,"overview_shared_code_dropdown_button":false,"react_blob_overlay":false,"copilot_conversational_ux_embedding_update":false,"copilot_smell_icebreaker_ux":true,"accessible_code_button":true}}}}</script> <div data-target="react-partial.reactRoot"><style data-styled="true" data-styled-version="5.3.11">.iVEunk{margin-top:16px;margin-bottom:16px;}/*!sc*/ .jzuOtQ{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}/*!sc*/ .bGojzy{margin-bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;row-gap:16px;}/*!sc*/ .iNSVHo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding-bottom:16px;padding-top:8px;}/*!sc*/ .bVgnfw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:8px;}/*!sc*/ @media screen and (max-width:320px){.bVgnfw{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}}/*!sc*/ .CEgMp{position:relative;}/*!sc*/ @media screen and (max-width:380px){.CEgMp .ref-selector-button-text-container{max-width:80px;}}/*!sc*/ @media screen and (max-width:320px){.CEgMp{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}.CEgMp .overview-ref-selector{width:100%;}.CEgMp .overview-ref-selector > span{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;}.CEgMp .overview-ref-selector > span > span[data-component="text"]{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}}/*!sc*/ .gMOVLe[data-size="medium"]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:0;}/*!sc*/ .gMOVLe[data-size="medium"] svg{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .gMOVLe[data-size="medium"] > span{width:inherit;}/*!sc*/ .gUkoLg{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}/*!sc*/ .bZBlpz{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;}/*!sc*/ .lhTYNA{margin-right:4px;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .ffLUq{font-size:14px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}/*!sc*/ .fLXEGX{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ @media screen and (max-width:1079px){.fLXEGX{display:none;}}/*!sc*/ .lmSMZJ[data-size="medium"]{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));padding-left:4px;padding-right:4px;}/*!sc*/ .lmSMZJ[data-size="medium"] span[data-component="leadingVisual"]{margin-right:4px !important;}/*!sc*/ .dqfxud{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ @media screen and (min-width:1080px){.dqfxud{display:none;}}/*!sc*/ @media screen and (max-width:543px){.dqfxud{display:none;}}/*!sc*/ .fGwBZA[data-size="medium"][data-no-visuals]{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .jxTzTd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding-left:8px;gap:8px;}/*!sc*/ .gqqBXN{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:8px;}/*!sc*/ @media screen and (max-width:543px){.gqqBXN{display:none;}}/*!sc*/ .dzXgxt{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ @media screen and (max-width:1011px){.dzXgxt{display:none;}}/*!sc*/ .iWFGlI{margin-left:8px;margin-right:8px;margin:0;}/*!sc*/ .YUPas{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ @media screen and (min-width:1012px){.YUPas{display:none;}}/*!sc*/ .izFOf{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ @media screen and (min-width:544px){.izFOf{display:none;}}/*!sc*/ .vIPPs{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:16px;}/*!sc*/ .fdROMU{width:100%;border-collapse:separate;border-spacing:0;border:1px solid;border-color:var(--borderColor-default,var(--color-border-default,#d0d7de));border-radius:6px;table-layout:fixed;overflow:unset;}/*!sc*/ .jGKpsv{height:0px;line-height:0px;}/*!sc*/ .jGKpsv tr{height:0px;font-size:0px;}/*!sc*/ .jdgHnn{padding:16px;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));font-size:12px;text-align:left;height:40px;}/*!sc*/ .jdgHnn th{padding-left:16px;background-color:var(--bgColor-muted,var(--color-canvas-subtle,#f6f8fa));}/*!sc*/ .bQivRW{width:100%;border-top-left-radius:6px;}/*!sc*/ @media screen and (min-width:544px){.bQivRW{display:none;}}/*!sc*/ .ldkMIO{width:40%;border-top-left-radius:6px;}/*!sc*/ @media screen and (max-width:543px){.ldkMIO{display:none;}}/*!sc*/ .jMbWeI{text-align:right;padding-right:16px;width:136px;border-top-right-radius:6px;}/*!sc*/ .gpqjiB{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));font-size:12px;height:40px;}/*!sc*/ .dzCJzi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;min-width:273px;padding:8px;}/*!sc*/ @media screen and (min-width:544px){.dzCJzi{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}}/*!sc*/ .eNCcrz{text-align:center;vertical-align:center;height:40px;border-top:1px solid;border-color:var(--borderColor-default,var(--color-border-default,#d0d7de));}/*!sc*/ .bHTcCe{border-top:1px solid var(--borderColor-default,var(--color-border-default));cursor:pointer;}/*!sc*/ .csrIcr{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;gap:16px;}/*!sc*/ .bUQNHB{border:1px solid;border-color:var(--borderColor-default,var(--color-border-default,#d0d7de));border-radius:6px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}/*!sc*/ @media screen and (max-width:543px){.bUQNHB{margin-left:-16px;margin-right:-16px;max-width:calc(100% + 32px);}}/*!sc*/ @media screen and (min-width:544px){.bUQNHB{max-width:100%;}}/*!sc*/ .jPdcfu{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-bottom:1px solid;border-bottom-color:var(--borderColor-default,var(--color-border-default,#d0d7de));-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-right:8px;position:-webkit-sticky;position:sticky;top:0;background-color:var(--bgColor-default,var(--color-canvas-default,#ffffff));z-index:1;border-top-left-radius:6px;border-top-right-radius:6px;}/*!sc*/ .hUCRAk{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .cwoBXV[data-size="medium"]{color:var(--fgColor-muted,var(--color-fg-subtle,#6e7781));padding-left:8px;padding-right:8px;}/*!sc*/ .QkQOb{padding:32px;overflow:auto;}/*!sc*/ data-styled.g1[id="Box-sc-g0xbh4-0"]{content:"iVEunk,jzuOtQ,bGojzy,iNSVHo,bVgnfw,CEgMp,gMOVLe,gUkoLg,bZBlpz,lhTYNA,ffLUq,fLXEGX,lmSMZJ,dqfxud,fGwBZA,jxTzTd,gqqBXN,dzXgxt,iWFGlI,YUPas,izFOf,vIPPs,fdROMU,jGKpsv,jdgHnn,bQivRW,ldkMIO,jMbWeI,gpqjiB,dzCJzi,eNCcrz,bHTcCe,csrIcr,bUQNHB,jPdcfu,hUCRAk,cwoBXV,QkQOb,"}/*!sc*/ .eMMFM{min-width:0;}/*!sc*/ .eMMFM:where([data-size='small']){font-size:var(--text-body-size-small,0.75rem);line-height:var(--text-body-lineHeight-small,1.6666);}/*!sc*/ .eMMFM:where([data-size='medium']){font-size:var(--text-body-size-medium,0.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);}/*!sc*/ .eMMFM:where([data-size='large']){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5);}/*!sc*/ .eMMFM:where([data-weight='light']){font-weight:var(--base-text-weight-light,300);}/*!sc*/ .eMMFM:where([data-weight='normal']){font-weight:var(--base-text-weight-normal,400);}/*!sc*/ .eMMFM:where([data-weight='medium']){font-weight:var(--base-text-weight-medium,500);}/*!sc*/ .eMMFM:where([data-weight='semibold']){font-weight:var(--base-text-weight-semibold,600);}/*!sc*/ data-styled.g3[id="Text__StyledText-sc-17v1xeu-0"]{content:"eMMFM,"}/*!sc*/ .brGdpi{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;-webkit-clip:rect(0,0,0,0);clip:rect(0,0,0,0);white-space:nowrap;border-width:0;}/*!sc*/ data-styled.g4[id="_VisuallyHidden__VisuallyHidden-sc-11jhm7a-0"]{content:"brGdpi,"}/*!sc*/ .jkNcAv{border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;}/*!sc*/ .jkNcAv:focus{outline:0;}/*!sc*/ data-styled.g13[id="UnstyledTextInput__ToggledUnstyledTextInput-sc-14ypya-0"]{content:"jkNcAv,"}/*!sc*/ .hLzFvi{font-size:14px;line-height:var(--base-size-20);color:var(--fgColor-default,var(--color-fg-default,#1F2328));vertical-align:middle;background-color:var(--bgColor-default,var(--color-canvas-default,#ffffff));border:1px solid var(--control-borderColor-rest,var(--borderColor-default,var(--color-border-default,#d0d7de)));border-radius:6px;outline:none;box-shadow:var(--shadow-inset,var(--color-primer-shadow-inset,inset 0 1px 0 rgba(208,215,222,0.2)));display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;min-height:var(--base-size-32);overflow:hidden;--inner-action-size:var(--base-size-24);}/*!sc*/ .hLzFvi input,.hLzFvi textarea{cursor:text;}/*!sc*/ .hLzFvi select{cursor:pointer;}/*!sc*/ .hLzFvi input::-webkit-input-placeholder,.hLzFvi textarea::-webkit-input-placeholder,.hLzFvi select::-webkit-input-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input::-moz-placeholder,.hLzFvi textarea::-moz-placeholder,.hLzFvi select::-moz-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input:-ms-input-placeholder,.hLzFvi textarea:-ms-input-placeholder,.hLzFvi select:-ms-input-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input::placeholder,.hLzFvi textarea::placeholder,.hLzFvi select::placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi:where([data-trailing-action][data-focused]),.hLzFvi:where(:not([data-trailing-action]):focus-within){border-color:var(--fgColor-accent,var(--color-accent-fg,#0969da));outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .hLzFvi > textarea{padding:var(--base-size-12);}/*!sc*/ .hLzFvi:where([data-contrast]){background-color:var(--bgColor-inset,var(--color-canvas-inset,#f6f8fa));}/*!sc*/ .hLzFvi:where([data-disabled]){color:var(--fgColor-disabled,var(--color-primer-fg-disabled,#8c959f));background-color:var(--control-bgColor-disabled,var(--color-input-disabled-bg,rgba(175,184,193,0.2)));box-shadow:none;border-color:var(--control-borderColor-disabled,var(--borderColor-default,var(--color-border-default,#d0d7de)));}/*!sc*/ .hLzFvi:where([data-disabled]) input,.hLzFvi:where([data-disabled]) textarea,.hLzFvi:where([data-disabled]) select{cursor:not-allowed;}/*!sc*/ .hLzFvi:where([data-monospace]){font-family:var(--fontStack-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace);}/*!sc*/ .hLzFvi:where([data-validation='error']){border-color:var(--borderColor-danger-emphasis,var(--color-danger-emphasis,#cf222e));}/*!sc*/ .hLzFvi:where([data-validation='error']):where([data-trailing-action][data-focused]),.hLzFvi:where([data-validation='error']):where(:not([data-trailing-action])):focus-within{border-color:var(--fgColor-accent,var(--color-accent-fg,#0969da));outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .hLzFvi:where([data-validation='success']){border-color:var(--bgColor-success-emphasis,var(--color-success-emphasis,#1f883d));}/*!sc*/ .hLzFvi:where([data-block]){width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;}/*!sc*/ @media (min-width:768px){.hLzFvi{font-size:var(--text-body-size-medium);}}/*!sc*/ .hLzFvi:where([data-size='small']){--inner-action-size:var(--base-size-20);min-height:var(--base-size-28);padding-top:3px;padding-right:var(--base-size-8);padding-bottom:3px;padding-left:var(--base-size-8);font-size:var(--text-body-size-small);line-height:var(--base-size-20);}/*!sc*/ .hLzFvi:where([data-size='large']){--inner-action-size:var(--base-size-28);height:var(--base-size-40);padding-top:10px;padding-right:var(--base-size-8);padding-bottom:10px;padding-left:var(--base-size-8);}/*!sc*/ .hLzFvi:where([data-variant='small']){min-height:28px;padding-top:3px;padding-right:var(--base-size-8);padding-bottom:3px;padding-left:var(--base-size-8);font-size:(--text-body-size-small);line-height:var(--base-size-20);}/*!sc*/ .hLzFvi:where([data-variant='large']){padding-top:10px;padding-right:var(--base-size-8);padding-bottom:10px;padding-left:var(--base-size-8);font-size:var(--text-title-size-medium);}/*!sc*/ .hLzFvi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:160px;}/*!sc*/ data-styled.g14[id="TextInputWrapper__StyledTextInputBaseWrapper-sc-1mqhpbi-0"]{content:"hLzFvi,"}/*!sc*/ .iHYdQq{background-repeat:no-repeat;background-position:right 8px center;padding-right:0;padding-left:0;}/*!sc*/ .iHYdQq > :not(:last-child){margin-right:8px;}/*!sc*/ .iHYdQq .TextInput-icon,.iHYdQq .TextInput-action{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}/*!sc*/ .iHYdQq > input,.iHYdQq > select{padding-right:0;padding-left:0;}/*!sc*/ .iHYdQq:where([data-leading-visual]){padding-left:var(--base-size-12);}/*!sc*/ .iHYdQq:where([data-trailing-visual]:not([data-trailing-action])){padding-right:var(--base-size-12);}/*!sc*/ .iHYdQq:where(:not([data-leading-visual])) > input,.iHYdQq:where(:not([data-leading-visual])) > select{padding-left:var(--base-size-12);}/*!sc*/ .iHYdQq:where(:not([data-trailing-visual]):not([data-trailing-action])) > input,.iHYdQq:where(:not([data-trailing-visual]):not([data-trailing-action])) > select{padding-right:var(--base-size-12);}/*!sc*/ .iHYdQq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:160px;}/*!sc*/ data-styled.g15[id="TextInputWrapper__StyledTextInputWrapper-sc-1mqhpbi-1"]{content:"iHYdQq,"}/*!sc*/ .hWlpPn{position:relative;display:inline-block;}/*!sc*/ .hWlpPn::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;-webkit-text-decoration:none;text-decoration:none;text-shadow:none;text-transform:none;-webkit-letter-spacing:normal;-moz-letter-spacing:normal;-ms-letter-spacing:normal;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;opacity:0;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .hWlpPn:hover::after,.hWlpPn:active::after,.hWlpPn:focus::after,.hWlpPn:focus-within::after{display:inline-block;-webkit-text-decoration:none;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-no-delay:hover::after,.hWlpPn.tooltipped-no-delay:active::after,.hWlpPn.tooltipped-no-delay:focus::after,.hWlpPn.tooltipped-no-delay:focus-within::after{-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-multiline:hover::after,.hWlpPn.tooltipped-multiline:active::after,.hWlpPn.tooltipped-multiline:focus::after,.hWlpPn.tooltipped-multiline:focus-within::after{display:table-cell;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-se::after,.hWlpPn.tooltipped-sw::after{top:100%;right:50%;margin-top:6px;}/*!sc*/ .hWlpPn.tooltipped-se::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-sw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-n::after,.hWlpPn.tooltipped-ne::after,.hWlpPn.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:6px;}/*!sc*/ .hWlpPn.tooltipped-ne::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-nw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-n::after{-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}/*!sc*/ .hWlpPn.tooltipped-w::after{right:100%;bottom:50%;margin-right:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-e::after{bottom:50%;left:100%;margin-left:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-multiline::after{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-s::after,.hWlpPn.tooltipped-multiline.tooltipped-n::after{right:auto;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-w::after,.hWlpPn.tooltipped-multiline.tooltipped-e::after{right:100%;}/*!sc*/ .hWlpPn.tooltipped-align-right-2::after{right:0;margin-right:0;}/*!sc*/ .hWlpPn.tooltipped-align-left-2::after{left:0;margin-left:0;}/*!sc*/ data-styled.g17[id="Tooltip__TooltipBase-sc-17tf59c-0"]{content:"hWlpPn,"}/*!sc*/ .liVpTx{display:inline-block;overflow:hidden;text-overflow:ellipsis;vertical-align:top;white-space:nowrap;max-width:125px;}/*!sc*/ data-styled.g19[id="Truncate__StyledTruncate-sc-23o1d2-0"]{content:"liVpTx,"}/*!sc*/ .eBevHz{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding-inline:var(--stack-padding-normal,16px);-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:var(--control-xlarge-size,48px);box-shadow:inset 0px -1px var(--borderColor-muted,var(--borderColor-muted,var(--color-border-muted,hsla(210,18%,87%,1))));-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;border-bottom:none;max-width:100%;padding-left:8px;padding-right:8px;}/*!sc*/ data-styled.g99[id="UnderlineTabbedInterface__StyledComponentUnderlineWrapper-sc-4ilrg0-0"]{content:"eBevHz,"}/*!sc*/ .ehEdWC{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;list-style:none;white-space:nowrap;padding:0;margin:0;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;position:relative;}/*!sc*/ data-styled.g100[id="UnderlineTabbedInterface__StyledComponentUnderlineItemList-sc-4ilrg0-1"]{content:"ehEdWC,"}/*!sc*/ .beOdPj{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:0;cursor:pointer;font:inherit;position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;color:var(--fgColor-default,var(--color-fg-default,#1F2328));text-align:center;-webkit-text-decoration:none;text-decoration:none;line-height:var(--text-body-lineHeight-medium,1.4285);border-radius:var(--borderRadius-medium,6px);font-size:var(--text-body-size-medium,14px);padding-inline:var(--control-medium-paddingInline-condensed,8px);padding-block:var(--control-medium-paddingBlock,6px);-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ @media (hover:hover){.beOdPj:hover{background-color:var(--bgColor-neutral-muted,var(--bgColor-neutral-muted,var(--color-neutral-subtle,rgba(234,238,242,0.5))));-webkit-transition:background 0.12s ease-out;transition:background 0.12s ease-out;-webkit-text-decoration:none;text-decoration:none;}}/*!sc*/ .beOdPj:focus:{outline:2px solid transparent;box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--fgColor-accent,var(--color-accent-fg,#0969da)));}/*!sc*/ .beOdPj:focus::not(:focus-visible){box-shadow:none;}/*!sc*/ .beOdPj:focus-visible{outline:2px solid transparent;box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--fgColor-accent,var(--color-accent-fg,#0969da)));}/*!sc*/ .beOdPj [data-content]::before{content:attr(data-content);display:block;height:0;font-weight:var(--base-text-weight-semibold,500);visibility:hidden;white-space:nowrap;}/*!sc*/ .beOdPj [data-component='icon']{color:var(--fgColor-muted,var(--fgColor-muted,var(--color-fg-muted,#656d76)));-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;margin-inline-end:var(--control-medium-gap,8px);}/*!sc*/ .beOdPj [data-component='counter']{margin-inline-start:var(--control-medium-gap,8px);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .beOdPj::after{position:absolute;right:50%;bottom:calc(50% - calc(var(--control-xlarge-size,48px) / 2 + 1px));width:100%;height:2px;content:'';background-color:transparent;border-radius:0;-webkit-transform:translate(50%,-50%);-ms-transform:translate(50%,-50%);transform:translate(50%,-50%);}/*!sc*/ .beOdPj[aria-current]:not([aria-current='false']) [data-component='text'],.beOdPj[aria-selected='true'] [data-component='text']{font-weight:var(--base-text-weight-semibold,500);}/*!sc*/ .beOdPj[aria-current]:not([aria-current='false'])::after,.beOdPj[aria-selected='true']::after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73));}/*!sc*/ @media (forced-colors:active){.beOdPj[aria-current]:not([aria-current='false'])::after,.beOdPj[aria-selected='true']::after{background-color:LinkText;}}/*!sc*/ data-styled.g101[id="UnderlineTabbedInterface__StyledUnderlineItem-sc-4ilrg0-2"]{content:"beOdPj,"}/*!sc*/ </style> <!-- --> <!-- --> <div class="Box-sc-g0xbh4-0 iVEunk"><div class="Box-sc-g0xbh4-0 jzuOtQ"><div class="Box-sc-g0xbh4-0 bGojzy"></div></div><div class="Box-sc-g0xbh4-0 iNSVHo"><div class="Box-sc-g0xbh4-0 bVgnfw"><div class="Box-sc-g0xbh4-0 CEgMp"><button type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="main branch" data-testid="anchor-button" class="Box-sc-g0xbh4-0 gMOVLe prc-Button-ButtonBase-c50BI overview-ref-selector width-full" data-loading="false" data-size="medium" data-variant="default" aria-describedby="branch-picker-repos-header-ref-selector-loading-announcement" id="branch-picker-repos-header-ref-selector"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x"><div class="Box-sc-g0xbh4-0 bZBlpz"><div class="Box-sc-g0xbh4-0 lhTYNA"><svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></div><div class="Box-sc-g0xbh4-0 ffLUq ref-selector-button-text-container"><span class="Text__StyledText-sc-17v1xeu-0 eMMFM"> <!-- -->main</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><button hidden="" data-hotkey-scope="read-only-cursor-text-area"></button></div><div class="Box-sc-g0xbh4-0 fLXEGX"><a style="--button-color:fg.muted" type="button" href="/QwenLM/Qwen/branches" class="Box-sc-g0xbh4-0 lmSMZJ prc-Button-ButtonBase-c50BI" data-loading="false" data-size="medium" data-variant="invisible" aria-describedby=":Rclab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x">Branches</span></span></a><a style="--button-color:fg.muted" type="button" href="/QwenLM/Qwen/tags" class="Box-sc-g0xbh4-0 lmSMZJ prc-Button-ButtonBase-c50BI" data-loading="false" data-size="medium" data-variant="invisible" aria-describedby=":Rklab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-tag" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1 7.775V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.752 1.752 0 0 1 1 7.775Zm1.5 0c0 .066.026.13.073.177l6.25 6.25a.25.25 0 0 0 .354 0l5.025-5.025a.25.25 0 0 0 0-.354l-6.25-6.25a.25.25 0 0 0-.177-.073H2.75a.25.25 0 0 0-.25.25ZM6 5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x">Tags</span></span></a></div><div class="Box-sc-g0xbh4-0 dqfxud"><a style="--button-color:fg.muted" type="button" aria-label="Go to Branches page" href="/QwenLM/Qwen/branches" class="Box-sc-g0xbh4-0 fGwBZA prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="invisible" aria-describedby=":Relab:-loading-announcement"><svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></a><a style="--button-color:fg.muted" type="button" aria-label="Go to Tags page" href="/QwenLM/Qwen/tags" class="Box-sc-g0xbh4-0 fGwBZA prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="invisible" aria-describedby=":Rmlab:-loading-announcement"><svg aria-hidden="true" focusable="false" class="octicon octicon-tag" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1 7.775V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.752 1.752 0 0 1 1 7.775Zm1.5 0c0 .066.026.13.073.177l6.25 6.25a.25.25 0 0 0 .354 0l5.025-5.025a.25.25 0 0 0 0-.354l-6.25-6.25a.25.25 0 0 0-.177-.073H2.75a.25.25 0 0 0-.25.25ZM6 5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z"></path></svg></a></div></div><div class="Box-sc-g0xbh4-0 jxTzTd"><div class="Box-sc-g0xbh4-0 gqqBXN"><div class="Box-sc-g0xbh4-0 dzXgxt"><!--$--><div class="Box-sc-g0xbh4-0 iWFGlI"><span class="TextInputWrapper__StyledTextInputBaseWrapper-sc-1mqhpbi-0 hLzFvi TextInputWrapper__StyledTextInputWrapper-sc-1mqhpbi-1 iHYdQq TextInput-wrapper" data-leading-visual="true" data-trailing-visual="true" aria-busy="false"><span class="TextInput-icon" id=":R2j5ab:" aria-hidden="true"><svg aria-hidden="true" focusable="false" class="octicon octicon-search" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg></span><input type="text" aria-label="Go to file" role="combobox" aria-controls="file-results-list" aria-expanded="false" aria-haspopup="dialog" autoCorrect="off" spellcheck="false" placeholder="Go to file" aria-describedby=":R2j5ab: :R2j5abH1:" data-component="input" class="UnstyledTextInput__ToggledUnstyledTextInput-sc-14ypya-0 jkNcAv" value=""/><span class="TextInput-icon" id=":R2j5abH1:" aria-hidden="true"></span></span></div><!--/$--></div><div class="Box-sc-g0xbh4-0 YUPas"><button type="button" class="prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":Rr5ab:-loading-announcement"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x">Go to file</span></span></button></div><div class="react-directory-add-file-icon"></div><div class="react-directory-remove-file-icon"></div></div><button type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-c50BI" data-loading="false" data-size="medium" data-variant="primary" aria-describedby=":R55ab:-loading-announcement" id=":R55ab:"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="hide-sm" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x">Code</span><span data-component="trailingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><div class="Box-sc-g0xbh4-0 izFOf"><button data-component="IconButton" type="button" aria-label="Open more actions menu" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-c50BI prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":R75ab:-loading-announcement" id=":R75ab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button></div></div></div><div class="Box-sc-g0xbh4-0 vIPPs"><div data-hpc="true"><button hidden="" data-testid="focus-next-element-button" data-hotkey="j"></button><button hidden="" data-testid="focus-previous-element-button" data-hotkey="k"></button><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading" id="folders-and-files">Folders and files</h2><table aria-labelledby="folders-and-files" class="Box-sc-g0xbh4-0 fdROMU"><thead class="Box-sc-g0xbh4-0 jGKpsv"><tr class="Box-sc-g0xbh4-0 jdgHnn"><th colSpan="2" class="Box-sc-g0xbh4-0 bQivRW"><span class="text-bold">Name</span></th><th colSpan="1" class="Box-sc-g0xbh4-0 ldkMIO"><span class="text-bold">Name</span></th><th class="hide-sm"><div title="Last commit message" class="Truncate__StyledTruncate-sc-23o1d2-0 liVpTx width-fit"><span class="text-bold">Last commit message</span></div></th><th colSpan="1" class="Box-sc-g0xbh4-0 jMbWeI"><div title="Last commit date" class="Truncate__StyledTruncate-sc-23o1d2-0 liVpTx width-fit"><span class="text-bold">Last commit date</span></div></th></tr></thead><tbody><tr class="Box-sc-g0xbh4-0 gpqjiB"><td colSpan="3" class="bgColor-muted p-1 rounded-top-2"><div class="Box-sc-g0xbh4-0 dzCJzi"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading">Latest commit</h2><div style="width:120px" class="Skeleton Skeleton--text" data-testid="loading"> </div><div class="d-flex flex-shrink-0 gap-2"><div data-testid="latest-commit-details" class="d-none d-sm-flex flex-items-center"></div><div class="d-flex gap-2"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading">History</h2><a href="/QwenLM/Qwen/commits/main/" class="prc-Button-ButtonBase-c50BI d-none d-lg-flex LinkButton-module__code-view-link-button--xvCGA flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby=":Raqj8pab:-loading-announcement"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x"><span class="fgColor-default">501 Commits</span></span></span></a><div class="d-sm-none"></div><div class="d-flex d-lg-none"><span role="tooltip" aria-label="501 Commits" id="history-icon-button-tooltip" class="Tooltip__TooltipBase-sc-17tf59c-0 hWlpPn tooltipped-n"><a href="/QwenLM/Qwen/commits/main/" class="prc-Button-ButtonBase-c50BI LinkButton-module__code-view-link-button--xvCGA flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby=":R1iqj8pab:-loading-announcement history-icon-button-tooltip"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span></span></a></span></div></div></div></div></td></tr><tr class="react-directory-row undefined" id="folder-row-0"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".github" aria-label=".github, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/.github">.github</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".github" aria-label=".github, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/.github">.github</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-1"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="ascend-support" aria-label="ascend-support, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/ascend-support">ascend-support</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="ascend-support" aria-label="ascend-support, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/ascend-support">ascend-support</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-2"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="assets" aria-label="assets, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/assets">assets</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="assets" aria-label="assets, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/assets">assets</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-3"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="dcu-support" aria-label="dcu-support, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/dcu-support">dcu-support</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="dcu-support" aria-label="dcu-support, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/dcu-support">dcu-support</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-4"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="docker" aria-label="docker, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/docker">docker</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="docker" aria-label="docker, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/docker">docker</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-5"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="eval" aria-label="eval, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/eval">eval</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="eval" aria-label="eval, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/eval">eval</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-6"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="examples" aria-label="examples, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/examples">examples</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="examples" aria-label="examples, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/examples">examples</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-7"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="finetune" aria-label="finetune, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/finetune">finetune</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="finetune" aria-label="finetune, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/finetune">finetune</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-8"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="recipes" aria-label="recipes, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/recipes">recipes</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="icon-directory" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="recipes" aria-label="recipes, (Directory)" class="Link--primary" href="/QwenLM/Qwen/tree/main/recipes">recipes</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row undefined" id="folder-row-9"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".dockerignore" aria-label=".dockerignore, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/.dockerignore">.dockerignore</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".dockerignore" aria-label=".dockerignore, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/.dockerignore">.dockerignore</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-10"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".gitignore" aria-label=".gitignore, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/.gitignore">.gitignore</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title=".gitignore" aria-label=".gitignore, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/.gitignore">.gitignore</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-11"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ.md" aria-label="FAQ.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ.md">FAQ.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ.md" aria-label="FAQ.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ.md">FAQ.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-12"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ_ja.md" aria-label="FAQ_ja.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ_ja.md">FAQ_ja.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ_ja.md" aria-label="FAQ_ja.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ_ja.md">FAQ_ja.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-13"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ_zh.md" aria-label="FAQ_zh.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ_zh.md">FAQ_zh.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="FAQ_zh.md" aria-label="FAQ_zh.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/FAQ_zh.md">FAQ_zh.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-14"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="LICENSE" aria-label="LICENSE, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/LICENSE">LICENSE</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="LICENSE" aria-label="LICENSE, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/LICENSE">LICENSE</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-15"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="NOTICE" aria-label="NOTICE, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/NOTICE">NOTICE</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="NOTICE" aria-label="NOTICE, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/NOTICE">NOTICE</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-16"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="QWEN_TECHNICAL_REPORT.pdf" aria-label="QWEN_TECHNICAL_REPORT.pdf, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/QWEN_TECHNICAL_REPORT.pdf">QWEN_TECHNICAL_REPORT.pdf</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="QWEN_TECHNICAL_REPORT.pdf" aria-label="QWEN_TECHNICAL_REPORT.pdf, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/QWEN_TECHNICAL_REPORT.pdf">QWEN_TECHNICAL_REPORT.pdf</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-17"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README.md" aria-label="README.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README.md">README.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README.md" aria-label="README.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README.md">README.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-18"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_CN.md" aria-label="README_CN.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_CN.md">README_CN.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_CN.md" aria-label="README_CN.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_CN.md">README_CN.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-19"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_ES.md" aria-label="README_ES.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_ES.md">README_ES.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_ES.md" aria-label="README_ES.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_ES.md">README_ES.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-20"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_FR.md" aria-label="README_FR.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_FR.md">README_FR.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_FR.md" aria-label="README_FR.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_FR.md">README_FR.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-21"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_JA.md" aria-label="README_JA.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_JA.md">README_JA.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="README_JA.md" aria-label="README_JA.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/README_JA.md">README_JA.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-22"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="Tongyi Qianwen LICENSE AGREEMENT" aria-label="Tongyi Qianwen LICENSE AGREEMENT, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT">Tongyi Qianwen LICENSE AGREEMENT</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="Tongyi Qianwen LICENSE AGREEMENT" aria-label="Tongyi Qianwen LICENSE AGREEMENT, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT">Tongyi Qianwen LICENSE AGREEMENT</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-23"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="Tongyi Qianwen RESEARCH LICENSE AGREEMENT" aria-label="Tongyi Qianwen RESEARCH LICENSE AGREEMENT, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20RESEARCH%20LICENSE%20AGREEMENT">Tongyi Qianwen RESEARCH LICENSE AGREEMENT</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="Tongyi Qianwen RESEARCH LICENSE AGREEMENT" aria-label="Tongyi Qianwen RESEARCH LICENSE AGREEMENT, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20RESEARCH%20LICENSE%20AGREEMENT">Tongyi Qianwen RESEARCH LICENSE AGREEMENT</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-24"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="cli_demo.py" aria-label="cli_demo.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/cli_demo.py">cli_demo.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="cli_demo.py" aria-label="cli_demo.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/cli_demo.py">cli_demo.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-25"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="finetune.py" aria-label="finetune.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/finetune.py">finetune.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="finetune.py" aria-label="finetune.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/finetune.py">finetune.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-26"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="openai_api.py" aria-label="openai_api.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/openai_api.py">openai_api.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="openai_api.py" aria-label="openai_api.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/openai_api.py">openai_api.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-27"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="requirements.txt" aria-label="requirements.txt, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/requirements.txt">requirements.txt</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="requirements.txt" aria-label="requirements.txt, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/requirements.txt">requirements.txt</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-28"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="requirements_web_demo.txt" aria-label="requirements_web_demo.txt, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/requirements_web_demo.txt">requirements_web_demo.txt</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="requirements_web_demo.txt" aria-label="requirements_web_demo.txt, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/requirements_web_demo.txt">requirements_web_demo.txt</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-29"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="run_gptq.py" aria-label="run_gptq.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/run_gptq.py">run_gptq.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="run_gptq.py" aria-label="run_gptq.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/run_gptq.py">run_gptq.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-30"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tech_memo.md" aria-label="tech_memo.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tech_memo.md">tech_memo.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tech_memo.md" aria-label="tech_memo.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tech_memo.md">tech_memo.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-31"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note.md" aria-label="tokenization_note.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note.md">tokenization_note.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note.md" aria-label="tokenization_note.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note.md">tokenization_note.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-32"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note_ja.md" aria-label="tokenization_note_ja.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note_ja.md">tokenization_note_ja.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note_ja.md" aria-label="tokenization_note_ja.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note_ja.md">tokenization_note_ja.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-33"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note_zh.md" aria-label="tokenization_note_zh.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note_zh.md">tokenization_note_zh.md</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="tokenization_note_zh.md" aria-label="tokenization_note_zh.md, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/tokenization_note_zh.md">tokenization_note_zh.md</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-34"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="utils.py" aria-label="utils.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/utils.py">utils.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="utils.py" aria-label="utils.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/utils.py">utils.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="react-directory-row truncate-for-mobile" id="folder-row-35"><td class="react-directory-row-name-cell-small-screen" colSpan="2"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="web_demo.py" aria-label="web_demo.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/web_demo.py">web_demo.py</a></div></div></div></div></td><td class="react-directory-row-name-cell-large-screen" colSpan="1"><div class="react-directory-filename-column"><svg aria-hidden="true" focusable="false" class="color-fg-muted" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg><div class="overflow-hidden"><div class="react-directory-filename-cell"><div class="react-directory-truncate"><a title="web_demo.py" aria-label="web_demo.py, (File)" class="Link--primary" href="/QwenLM/Qwen/blob/main/web_demo.py">web_demo.py</a></div></div></div></div></td><td class="react-directory-row-commit-cell"><div class="Skeleton Skeleton--text"> </div></td><td><div class="Skeleton Skeleton--text"> </div></td></tr><tr class="Box-sc-g0xbh4-0 eNCcrz show-for-mobile" data-testid="view-all-files-row"><td colSpan="3" class="Box-sc-g0xbh4-0 bHTcCe"><div><button class="prc-Link-Link-85e08">View all files</button></div></td></tr></tbody></table></div><div class="Box-sc-g0xbh4-0 csrIcr"><div class="Box-sc-g0xbh4-0 bUQNHB"><div itemscope="" itemType="https://schema.org/abstract" class="Box-sc-g0xbh4-0 jPdcfu"><h2 class="_VisuallyHidden__VisuallyHidden-sc-11jhm7a-0 brGdpi">Repository files navigation</h2><nav class="UnderlineTabbedInterface__StyledComponentUnderlineWrapper-sc-4ilrg0-0 eBevHz" aria-label="Repository files"><ul role="list" class="UnderlineTabbedInterface__StyledComponentUnderlineItemList-sc-4ilrg0-1 ehEdWC"><li class="Box-sc-g0xbh4-0 hUCRAk"><a href="#" aria-current="page" class="UnderlineTabbedInterface__StyledUnderlineItem-sc-4ilrg0-2 beOdPj"><span data-component="icon"><svg aria-hidden="true" focusable="false" class="octicon octicon-book" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path></svg></span><span data-component="text" data-content="README">README</span></a></li><li class="Box-sc-g0xbh4-0 hUCRAk"><a href="#" class="UnderlineTabbedInterface__StyledUnderlineItem-sc-4ilrg0-2 beOdPj"><span data-component="icon"><svg aria-hidden="true" focusable="false" class="octicon octicon-law" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z"></path></svg></span><span data-component="text" data-content="Apache-2.0 license">Apache-2.0 license</span></a></li></ul></nav><button style="--button-color:fg.subtle" type="button" aria-label="Outline" aria-haspopup="true" aria-expanded="false" tabindex="0" class="Box-sc-g0xbh4-0 cwoBXV prc-Button-ButtonBase-c50BI" data-loading="false" data-size="medium" data-variant="invisible" aria-describedby=":Rr9ab:-loading-announcement" id=":Rr9ab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-list-unordered" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M5.75 2.5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5ZM2 14a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM2 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg></button></div><div class="Box-sc-g0xbh4-0 QkQOb js-snippet-clipboard-copy-unpositioned undefined" data-hpc="true"><article class="markdown-body entry-content container-lg" itemprop="text"><p align="left" dir="auto"> <a href="/QwenLM/Qwen/blob/main/README_CN.md">中文</a> | English | <a href="/QwenLM/Qwen/blob/main/README_JA.md">日本語</a> | <a href="/QwenLM/Qwen/blob/main/README_FR.md">Français</a> | <a href="/QwenLM/Qwen/blob/main/README_ES.md">Español</a> </p> <br><br> <p align="center" dir="auto"> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/9b22e1232168606b1f0a237a93d447f3f06187caa8b6f036556f71050846bc86/68747470733a2f2f7169616e77656e2d7265732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6c6f676f5f7177656e2e6a7067"><img src="https://camo.githubusercontent.com/9b22e1232168606b1f0a237a93d447f3f06187caa8b6f036556f71050846bc86/68747470733a2f2f7169616e77656e2d7265732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f6c6f676f5f7177656e2e6a7067" width="400" data-canonical-src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/logo_qwen.jpg" style="max-width: 100%;"></a> </p><p dir="auto"> <br> </p><p align="center" dir="auto"> 🤗 <a href="https://huggingface.co/Qwen" rel="nofollow">Hugging Face</a> | 🤖 <a href="https://modelscope.cn/organization/qwen" rel="nofollow">ModelScope</a> | 📑 <a href="https://arxiv.org/abs/2309.16609" rel="nofollow">Paper</a> | 🖥️ <a href="https://modelscope.cn/studios/qwen/Qwen-72B-Chat-Demo/summary" rel="nofollow">Demo</a> <br> <a href="/QwenLM/Qwen/blob/main/assets/wechat.png">WeChat (微信)</a> | <a href="https://discord.gg/CV4E9rpNSD" rel="nofollow">Discord</a> | <a href="https://dashscope.aliyun.com" rel="nofollow">API</a> </p> <br><br> <div class="markdown-alert markdown-alert-important" dir="auto"><p class="markdown-alert-title" dir="auto"><svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>Important</p><p dir="auto">Qwen2 is here! You are welcome to follow <a href="https://github.com/QwenLM/Qwen2">QwenLM/Qwen2</a> and share your experience there.</p> <p dir="auto">This repo (<a href="https://github.com/QwenLM/Qwen">QwenLM/Qwen</a>) is no longer actively maintained, due to substantial codebase differences.</p> </div> <br> <markdown-accessiblity-table><table> <thead> <tr> <th></th> <th align="center">Qwen-Chat</th> <th align="center">Qwen-Chat (Int4)</th> <th align="center">Qwen-Chat (Int8)</th> <th align="center">Qwen</th> </tr> </thead> <tbody> <tr> <td>1.8B</td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-1_8B-Chat/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-1_8B-Chat" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-1_8B-Chat-Int4/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-1_8B-Chat-Int4" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-1_8B-Chat-Int8/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-1_8B-Chat-Int8" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-1_8B/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-1_8B" rel="nofollow">🤗</a></td> </tr> <tr> <td>7B</td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-7B-Chat/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-7B-Chat" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-7B-Chat-Int4/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-7B-Chat-Int4" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-7B-Chat-Int8/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-7B-Chat-Int8" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-7B/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-7B" rel="nofollow">🤗</a></td> </tr> <tr> <td>14B</td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-14B-Chat/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-14B-Chat" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-14B-Chat-Int4/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-14B-Chat-Int4" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-14B-Chat-Int8/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-14B-Chat-Int8" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-14B/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-14B" rel="nofollow">🤗</a></td> </tr> <tr> <td>72B</td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-72B-Chat/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-72B-Chat" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-72B-Chat-Int4/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-72B-Chat-Int4" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-72B-Chat-Int8/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-72B-Chat-Int8" rel="nofollow">🤗</a></td> <td align="center"><a href="https://modelscope.cn/models/qwen/Qwen-72B/summary" rel="nofollow">🤖</a> <a href="https://huggingface.co/Qwen/Qwen-72B" rel="nofollow">🤗</a></td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">We opensource our <strong>Qwen</strong> series, now including <strong>Qwen</strong>, the base language models, namely <strong>Qwen-1.8B</strong>, <strong>Qwen-7B</strong>, <strong>Qwen-14B</strong>, and <strong>Qwen-72B</strong>, as well as <strong>Qwen-Chat</strong>, the chat models, namely <strong>Qwen-1.8B-Chat</strong>, <strong>Qwen-7B-Chat</strong>, <strong>Qwen-14B-Chat</strong>, and <strong>Qwen-72B-Chat</strong>. Links are on the above table. Click them and check the model cards. Also, we release the <strong><a href="https://arxiv.org/abs/2309.16609" rel="nofollow">technical report</a></strong>. Please click the paper link and check it out!</p> <p dir="auto">In brief, we have strong base language models, which have been stably pretrained for up to 3 trillion tokens of multilingual data with a wide coverage of domains, languages (with a focus on Chinese and English), etc. They are able to achieve competitive performance on benchmark datasets. Additionally, we have chat models that are aligned with human preference based on SFT and RLHF (not released yet), which are able to chat, create content, extract information, summarize, translate, code, solve math problems, and so on, and are able to use tools, play as agents, or even play as code interpreters, etc.</p> <markdown-accessiblity-table><table> <thead> <tr> <th align="left">Model</th> <th align="center">Release Date</th> <th align="center">Max Length</th> <th align="center">System Prompt Enhancement</th> <th align="center"># of Pretrained Tokens</th> <th align="center">Minimum GPU Memory Usage of Finetuning (Q-Lora)</th> <th align="center">Minimum GPU Usage of Generating 2048 Tokens (Int4)</th> <th align="center">Tool Usage</th> </tr> </thead> <tbody> <tr> <td align="left">Qwen-1.8B</td> <td align="center">23.11.30</td> <td align="center">32K</td> <td align="center">✅</td> <td align="center">2.2T</td> <td align="center">5.8GB</td> <td align="center">2.9GB</td> <td align="center">✅</td> </tr> <tr> <td align="left">Qwen-7B</td> <td align="center">23.08.03</td> <td align="center">32K</td> <td align="center">❎</td> <td align="center">2.4T</td> <td align="center">11.5GB</td> <td align="center">8.2GB</td> <td align="center">✅</td> </tr> <tr> <td align="left">Qwen-14B</td> <td align="center">23.09.25</td> <td align="center">8K</td> <td align="center">❎</td> <td align="center">3.0T</td> <td align="center">18.7GB</td> <td align="center">13.0GB</td> <td align="center">✅</td> </tr> <tr> <td align="left">Qwen-72B</td> <td align="center">23.11.30</td> <td align="center">32K</td> <td align="center">✅</td> <td align="center">3.0T</td> <td align="center">61.4GB</td> <td align="center">48.9GB</td> <td align="center">✅</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">In this repo, you can figure out:</p> <ul dir="auto"> <li>Quickstart with Qwen, and enjoy the simple inference.</li> <li>Details about the quantization models, including GPTQ and KV cache quantization.</li> <li>Statistics of inference performance, including speed and memory.</li> <li>Tutorials on finetuning, including full-parameter tuning, LoRA, and Q-LoRA.</li> <li>Instructions on deployment, with the example of vLLM and FastChat.</li> <li>Instructions on building demos, including WebUI, CLI demo, etc.</li> <li>Introduction to DashScope API service, as well as the instructions on building an OpenAI-style API for your model.</li> <li>Information about Qwen for tool use, agent, and code interpreter</li> <li>Statistics of long-context understanding evaluation</li> <li>License agreement</li> <li>...</li> </ul> <p dir="auto">Also, if you meet problems, turn to <a href="/QwenLM/Qwen/blob/main/FAQ.md">FAQ</a> for help first. Still feeling struggled? Feel free to shoot us issues (better in English so that more people can understand you)! If you would like to help us, send us pull requests with no hesitation! We are always excited about PR!</p> <p dir="auto">Would like to chat with us or date us coffee time? Welcome to our Discord or WeChat! <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">News and Updates</h2><a id="user-content-news-and-updates" class="anchor" aria-label="Permalink: News and Updates" href="#news-and-updates"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>2023.11.30 🔥 We release <strong>Qwen-72B</strong> and <strong>Qwen-72B-Chat</strong>, which are trained on 3T tokens and support 32k context, along with <strong>Qwen-1.8B</strong>, and <strong>Qwen-1.8B-Chat</strong>, on ModelScope and Hugging Face. We have also strengthened the System Prompt capabilities of the Qwen-72B-Chat and Qwen-1.8B-Chat, see <a href="/QwenLM/Qwen/blob/main/examples/system_prompt.md">example documentation</a>. Additionally, support the inference on <strong>Ascend 910</strong> and <strong>Hygon DCU</strong>. Check <code>ascend-support</code> and <code>dcu-support</code> for more details.</li> <li>2023.10.17 We release the Int8 quantized model <strong>Qwen-7B-Chat-Int8</strong> and <strong>Qwen-14B-Chat-Int8</strong>.</li> <li>2023.9.25 🔥 We release <strong>Qwen-14B</strong> and <strong>Qwen-14B-Chat</strong> on ModelScope and Hugging Face, along with <a href="https://github.com/QwenLM/qwen.cpp">qwen.cpp</a> and <a href="https://github.com/QwenLM/Qwen-Agent">Qwen-Agent</a>. Codes and checkpoints of <strong>Qwen-7B</strong> and <strong>Qwen-7B-Chat</strong> are also updated. <strong>PLEASE PULL THE LATEST VERSION!</strong> <ul dir="auto"> <li>Compared to <strong>Qwen-7B</strong> (original), <strong>Qwen-7B</strong> uses more training tokens, increasing from 2.2T tokens to 2.4T tokens, while the context length extends from 2048 to 8192. The Chinese knowledge and coding ability of <strong>Qwen-7B</strong> have been further improved.</li> </ul> </li> <li>2023.9.12 We now support finetuning on the Qwen-7B models, including full-parameter finetuning, LoRA and Q-LoRA.</li> <li>2023.8.21 We release the Int4 quantized model for Qwen-7B-Chat, <strong>Qwen-7B-Chat-Int4</strong>, which requires low memory costs but achieves improved inference speed. Besides, there is no significant performance degradation on the benchmark evaluation.</li> <li>2023.8.3 We release both <strong>Qwen-7B</strong> and <strong>Qwen-7B-Chat</strong> on ModelScope and Hugging Face. We also provide a technical memo for more details about the model, including training details and model performance.</li> </ul> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Performance</h2><a id="user-content-performance" class="anchor" aria-label="Permalink: Performance" href="#performance"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Qwen models outperform the baseline models of similar model sizes on a series of benchmark datasets, e.g., MMLU, C-Eval, GSM8K, MATH, HumanEval, MBPP, BBH, etc., which evaluate the models’ capabilities on natural language understanding, mathematic problem solving, coding, etc. Qwen-72B achieves better performance than LLaMA2-70B on all tasks and outperforms GPT-3.5 on 7 out of 10 tasks.</p> <p align="left" dir="auto"> <a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/radar_72b.jpg"><img src="/QwenLM/Qwen/raw/main/assets/radar_72b.jpg" width="600px/" style="max-width: 100%;"></a> </p><p dir="auto"> <br> </p><markdown-accessiblity-table><table> <thead> <tr> <th align="left">Model</th> <th align="center">MMLU</th> <th align="center">C-Eval</th> <th align="center">GSM8K</th> <th align="center">MATH</th> <th align="center">HumanEval</th> <th align="center">MBPP</th> <th align="center">BBH</th> <th align="center">CMMLU</th> </tr> </thead> <tbody> <tr> <td align="left"></td> <td align="center">5-shot</td> <td align="center">5-shot</td> <td align="center">8-shot</td> <td align="center">4-shot</td> <td align="center">0-shot</td> <td align="center">3-shot</td> <td align="center">3-shot</td> <td align="center">5-shot</td> </tr> <tr> <td align="left">LLaMA2-7B</td> <td align="center">46.8</td> <td align="center">32.5</td> <td align="center">16.7</td> <td align="center">3.3</td> <td align="center">12.8</td> <td align="center">20.8</td> <td align="center">38.2</td> <td align="center">31.8</td> </tr> <tr> <td align="left">LLaMA2-13B</td> <td align="center">55.0</td> <td align="center">41.4</td> <td align="center">29.6</td> <td align="center">5.0</td> <td align="center">18.9</td> <td align="center">30.3</td> <td align="center">45.6</td> <td align="center">38.4</td> </tr> <tr> <td align="left">LLaMA2-34B</td> <td align="center">62.6</td> <td align="center">-</td> <td align="center">42.2</td> <td align="center">6.2</td> <td align="center">22.6</td> <td align="center">33.0</td> <td align="center">44.1</td> <td align="center">-</td> </tr> <tr> <td align="left">ChatGLM2-6B</td> <td align="center">47.9</td> <td align="center">51.7</td> <td align="center">32.4</td> <td align="center">6.5</td> <td align="center">-</td> <td align="center">-</td> <td align="center">33.7</td> <td align="center">-</td> </tr> <tr> <td align="left">InternLM-7B</td> <td align="center">51.0</td> <td align="center">53.4</td> <td align="center">31.2</td> <td align="center">6.3</td> <td align="center">10.4</td> <td align="center">14.0</td> <td align="center">37.0</td> <td align="center">51.8</td> </tr> <tr> <td align="left">InternLM-20B</td> <td align="center">62.1</td> <td align="center">58.8</td> <td align="center">52.6</td> <td align="center">7.9</td> <td align="center">25.6</td> <td align="center">35.6</td> <td align="center">52.5</td> <td align="center">59.0</td> </tr> <tr> <td align="left">Baichuan2-7B</td> <td align="center">54.7</td> <td align="center">56.3</td> <td align="center">24.6</td> <td align="center">5.6</td> <td align="center">18.3</td> <td align="center">24.2</td> <td align="center">41.6</td> <td align="center">57.1</td> </tr> <tr> <td align="left">Baichuan2-13B</td> <td align="center">59.5</td> <td align="center">59.0</td> <td align="center">52.8</td> <td align="center">10.1</td> <td align="center">17.1</td> <td align="center">30.2</td> <td align="center">49.0</td> <td align="center">62.0</td> </tr> <tr> <td align="left">Yi-34B</td> <td align="center">76.3</td> <td align="center">81.8</td> <td align="center">67.9</td> <td align="center">15.9</td> <td align="center">26.2</td> <td align="center">38.2</td> <td align="center">66.4</td> <td align="center">82.6</td> </tr> <tr> <td align="left">XVERSE-65B</td> <td align="center">70.8</td> <td align="center">68.6</td> <td align="center">60.3</td> <td align="center">-</td> <td align="center">26.3</td> <td align="center">-</td> <td align="center">-</td> <td align="center">-</td> </tr> <tr> <td align="left"><strong>Qwen-1.8B</strong></td> <td align="center">45.3</td> <td align="center">56.1</td> <td align="center">32.3</td> <td align="center">2.3</td> <td align="center">15.2</td> <td align="center">14.2</td> <td align="center">22.3</td> <td align="center">52.1</td> </tr> <tr> <td align="left"><strong>Qwen-7B</strong></td> <td align="center">58.2</td> <td align="center">63.5</td> <td align="center">51.7</td> <td align="center">11.6</td> <td align="center">29.9</td> <td align="center">31.6</td> <td align="center">45.0</td> <td align="center">62.2</td> </tr> <tr> <td align="left"><strong>Qwen-14B</strong></td> <td align="center">66.3</td> <td align="center">72.1</td> <td align="center">61.3</td> <td align="center">24.8</td> <td align="center">32.3</td> <td align="center">40.8</td> <td align="center">53.4</td> <td align="center">71.0</td> </tr> <tr> <td align="left"><strong>Qwen-72B</strong></td> <td align="center"><strong>77.4</strong></td> <td align="center"><strong>83.3</strong></td> <td align="center"><strong>78.9</strong></td> <td align="center"><strong>35.2</strong></td> <td align="center"><strong>35.4</strong></td> <td align="center"><strong>52.2</strong></td> <td align="center"><strong>67.7</strong></td> <td align="center"><strong>83.6</strong></td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">For all compared models, we report the best scores between their official reported results and <a href="https://opencompass.org.cn/leaderboard-llm" rel="nofollow">OpenCompass</a>.</p> <p dir="auto">For more experimental results (detailed model performance on more benchmark datasets) and details, please refer to our technical report by clicking <a href="https://qianwen-res.oss-cn-beijing.aliyuncs.com/QWEN_TECHNICAL_REPORT.pdf" rel="nofollow">here</a>. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Requirements</h2><a id="user-content-requirements" class="anchor" aria-label="Permalink: Requirements" href="#requirements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>python 3.8 and above</li> <li>pytorch 1.12 and above, 2.0 and above are recommended</li> <li>transformers 4.32 and above</li> <li>CUDA 11.4 and above are recommended (this is for GPU users, flash-attention users, etc.)</li> </ul> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Quickstart</h2><a id="user-content-quickstart" class="anchor" aria-label="Permalink: Quickstart" href="#quickstart"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Below, we provide simple examples to show how to use Qwen-Chat with 🤖 ModelScope and 🤗 Transformers.</p> <p dir="auto">You can use our pre-built docker images to skip most of the environment setup steps, see Section <a href="#-docker">"Using Pre-built Docker Images"</a> for more details.</p> <p dir="auto">If not using docker, please make sure you have setup the environment and installed the required packages. Make sure you meet the above requirements, and then install the dependent libraries.</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install -r requirements.txt"><pre>pip install -r requirements.txt</pre></div> <p dir="auto">If your device supports fp16 or bf16, we recommend installing <a href="https://github.com/Dao-AILab/flash-attention">flash-attention</a> (<strong>we support flash attention 2 now.</strong>) for higher efficiency and lower memory usage. (<strong>flash-attention is optional and the project can run normally without installing it</strong>)</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/Dao-AILab/flash-attention cd flash-attention && pip install . # Below are optional. Installing them might be slow. # pip install csrc/layer_norm # If the version of flash-attn is higher than 2.1.1, the following is not needed. # pip install csrc/rotary"><pre>git clone https://github.com/Dao-AILab/flash-attention <span class="pl-c1">cd</span> flash-attention <span class="pl-k">&&</span> pip install <span class="pl-c1">.</span> <span class="pl-c"><span class="pl-c">#</span> Below are optional. Installing them might be slow.</span> <span class="pl-c"><span class="pl-c">#</span> pip install csrc/layer_norm</span> <span class="pl-c"><span class="pl-c">#</span> If the version of flash-attn is higher than 2.1.1, the following is not needed.</span> <span class="pl-c"><span class="pl-c">#</span> pip install csrc/rotary</span></pre></div> <p dir="auto">Now you can start with ModelScope or Transformers.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">🤗 Transformers</h3><a id="user-content--transformers" class="anchor" aria-label="Permalink: 🤗 Transformers" href="#-transformers"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">To use Qwen-Chat for the inference, all you need to do is to input a few lines of codes as demonstrated below. Remember to pass in the correct model names or paths, such as "Qwen/Qwen-7B-Chat" and "Qwen/Qwen-14B-Chat". However, <strong>please make sure that you are using the latest code.</strong></p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation import GenerationConfig # Model names: "Qwen/Qwen-7B-Chat", "Qwen/Qwen-14B-Chat" tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True) # use bf16 # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, bf16=True).eval() # use fp16 # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, fp16=True).eval() # use cpu only # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="cpu", trust_remote_code=True).eval() # use auto mode, automatically select precision based on the device. model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True ).eval() # Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this. # model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True) # 1st dialogue turn response, history = model.chat(tokenizer, "你好", history=None) print(response) # 你好!很高兴为你提供帮助。 # 2nd dialogue turn response, history = model.chat(tokenizer, "给我讲一个年轻人奋斗创业最终取得成功的故事。", history=history) print(response) # 这是一个关于一个年轻人奋斗创业最终取得成功的故事。 # 故事的主人公叫李明,他来自一个普通的家庭,父母都是普通的工人。从小,李明就立下了一个目标:要成为一名成功的企业家。 # 为了实现这个目标,李明勤奋学习,考上了大学。在大学期间,他积极参加各种创业比赛,获得了不少奖项。他还利用课余时间去实习,积累了宝贵的经验。 # 毕业后,李明决定开始自己的创业之路。他开始寻找投资机会,但多次都被拒绝了。然而,他并没有放弃。他继续努力,不断改进自己的创业计划,并寻找新的投资机会。 # 最终,李明成功地获得了一笔投资,开始了自己的创业之路。他成立了一家科技公司,专注于开发新型软件。在他的领导下,公司迅速发展起来,成为了一家成功的科技企业。 # 李明的成功并不是偶然的。他勤奋、坚韧、勇于冒险,不断学习和改进自己。他的成功也证明了,只要努力奋斗,任何人都有可能取得成功。 # 3rd dialogue turn response, history = model.chat(tokenizer, "给这个故事起一个标题", history=history) print(response) # 《奋斗创业:一个年轻人的成功之路》"><pre><span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span>.<span class="pl-s1">generation</span> <span class="pl-k">import</span> <span class="pl-v">GenerationConfig</span> <span class="pl-c"># Model names: "Qwen/Qwen-7B-Chat", "Qwen/Qwen-14B-Chat"</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"Qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-c"># use bf16</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, bf16=True).eval()</span> <span class="pl-c"># use fp16</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, fp16=True).eval()</span> <span class="pl-c"># use cpu only</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="cpu", trust_remote_code=True).eval()</span> <span class="pl-c"># use auto mode, automatically select precision based on the device.</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">"Qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-c"># Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this.</span> <span class="pl-c"># model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True)</span> <span class="pl-c"># 1st dialogue turn</span> <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"你好"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-c"># 你好!很高兴为你提供帮助。</span> <span class="pl-c"># 2nd dialogue turn</span> <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"给我讲一个年轻人奋斗创业最终取得成功的故事。"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-c"># 这是一个关于一个年轻人奋斗创业最终取得成功的故事。</span> <span class="pl-c"># 故事的主人公叫李明,他来自一个普通的家庭,父母都是普通的工人。从小,李明就立下了一个目标:要成为一名成功的企业家。</span> <span class="pl-c"># 为了实现这个目标,李明勤奋学习,考上了大学。在大学期间,他积极参加各种创业比赛,获得了不少奖项。他还利用课余时间去实习,积累了宝贵的经验。</span> <span class="pl-c"># 毕业后,李明决定开始自己的创业之路。他开始寻找投资机会,但多次都被拒绝了。然而,他并没有放弃。他继续努力,不断改进自己的创业计划,并寻找新的投资机会。</span> <span class="pl-c"># 最终,李明成功地获得了一笔投资,开始了自己的创业之路。他成立了一家科技公司,专注于开发新型软件。在他的领导下,公司迅速发展起来,成为了一家成功的科技企业。</span> <span class="pl-c"># 李明的成功并不是偶然的。他勤奋、坚韧、勇于冒险,不断学习和改进自己。他的成功也证明了,只要努力奋斗,任何人都有可能取得成功。</span> <span class="pl-c"># 3rd dialogue turn</span> <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"给这个故事起一个标题"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-c"># 《奋斗创业:一个年轻人的成功之路》</span></pre></div> <p dir="auto">Running Qwen, the base language model, is also simple.</p> <details> <summary>Running Qwen</summary> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation import GenerationConfig # Model names: "Qwen/Qwen-7B", "Qwen/Qwen-14B" tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-7B", trust_remote_code=True) # use bf16 # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="auto", trust_remote_code=True, bf16=True).eval() # use fp16 # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="auto", trust_remote_code=True, fp16=True).eval() # use cpu only # model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="cpu", trust_remote_code=True).eval() # use auto mode, automatically select precision based on the device. model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen-7B", device_map="auto", trust_remote_code=True ).eval() # Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this. # model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B", trust_remote_code=True) inputs = tokenizer('蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是', return_tensors='pt') inputs = inputs.to(model.device) pred = model.generate(**inputs) print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True)) # 蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是亚的斯亚贝巴(Addis Ababa)..."><pre><span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span>.<span class="pl-s1">generation</span> <span class="pl-k">import</span> <span class="pl-v">GenerationConfig</span> <span class="pl-c"># Model names: "Qwen/Qwen-7B", "Qwen/Qwen-14B" </span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"Qwen/Qwen-7B"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-c"># use bf16</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="auto", trust_remote_code=True, bf16=True).eval()</span> <span class="pl-c"># use fp16</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="auto", trust_remote_code=True, fp16=True).eval()</span> <span class="pl-c"># use cpu only</span> <span class="pl-c"># model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B", device_map="cpu", trust_remote_code=True).eval()</span> <span class="pl-c"># use auto mode, automatically select precision based on the device.</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">"Qwen/Qwen-7B"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-c"># Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this.</span> <span class="pl-c"># model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B", trust_remote_code=True)</span> <span class="pl-s1">inputs</span> <span class="pl-c1">=</span> <span class="pl-en">tokenizer</span>(<span class="pl-s">'蒙古国的首都是乌兰巴托(Ulaanbaatar)<span class="pl-cce">\n</span>冰岛的首都是雷克雅未克(Reykjavik)<span class="pl-cce">\n</span>埃塞俄比亚的首都是'</span>, <span class="pl-s1">return_tensors</span><span class="pl-c1">=</span><span class="pl-s">'pt'</span>) <span class="pl-s1">inputs</span> <span class="pl-c1">=</span> <span class="pl-s1">inputs</span>.<span class="pl-c1">to</span>(<span class="pl-s1">model</span>.<span class="pl-c1">device</span>) <span class="pl-s1">pred</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">generate</span>(<span class="pl-c1">**</span><span class="pl-s1">inputs</span>) <span class="pl-en">print</span>(<span class="pl-s1">tokenizer</span>.<span class="pl-c1">decode</span>(<span class="pl-s1">pred</span>.<span class="pl-c1">cpu</span>()[<span class="pl-c1">0</span>], <span class="pl-s1">skip_special_tokens</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)) <span class="pl-c"># 蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是亚的斯亚贝巴(Addis Ababa)...</span></pre></div> </details> <p id="user-content-downloadmodel" dir="auto"> In the event of a network issue while attempting to download model checkpoints and codes from HuggingFace, an alternative approach is to initially fetch the checkpoint from ModelScope and then load it from the local directory as outlined below: </p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from modelscope import snapshot_download from transformers import AutoModelForCausalLM, AutoTokenizer # Downloading model checkpoint to a local dir model_dir # model_dir = snapshot_download('qwen/Qwen-7B') # model_dir = snapshot_download('qwen/Qwen-7B-Chat') # model_dir = snapshot_download('qwen/Qwen-14B') model_dir = snapshot_download('qwen/Qwen-14B-Chat') # Loading local checkpoints # trust_remote_code is still set as True since we still load codes from local dir instead of transformers tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_dir, device_map="auto", trust_remote_code=True ).eval()"><pre><span class="pl-k">from</span> <span class="pl-s1">modelscope</span> <span class="pl-k">import</span> <span class="pl-s1">snapshot_download</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-c"># Downloading model checkpoint to a local dir model_dir</span> <span class="pl-c"># model_dir = snapshot_download('qwen/Qwen-7B')</span> <span class="pl-c"># model_dir = snapshot_download('qwen/Qwen-7B-Chat')</span> <span class="pl-c"># model_dir = snapshot_download('qwen/Qwen-14B')</span> <span class="pl-s1">model_dir</span> <span class="pl-c1">=</span> <span class="pl-en">snapshot_download</span>(<span class="pl-s">'qwen/Qwen-14B-Chat'</span>) <span class="pl-c"># Loading local checkpoints</span> <span class="pl-c"># trust_remote_code is still set as True since we still load codes from local dir instead of transformers</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s1">model_dir</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s1">model_dir</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>()</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">🤖 ModelScope</h3><a id="user-content--modelscope" class="anchor" aria-label="Permalink: 🤖 ModelScope" href="#-modelscope"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">ModelScope is an open-source platform for Model-as-a-Service (MaaS), which provides flexible and cost-effective model service to AI developers. Similarly, you can run the models with ModelScope as shown below:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from modelscope import AutoModelForCausalLM, AutoTokenizer from modelscope import GenerationConfig # Model names: "qwen/Qwen-7B-Chat", "qwen/Qwen-14B-Chat" tokenizer = AutoTokenizer.from_pretrained("qwen/Qwen-7B-Chat", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, fp16=True).eval() model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True) # 可指定不同的生成长度、top_p等相关超参 response, history = model.chat(tokenizer, "你好", history=None) print(response) response, history = model.chat(tokenizer, "浙江的省会在哪里?", history=history) print(response) response, history = model.chat(tokenizer, "它有什么好玩的景点", history=history) print(response)"><pre><span class="pl-k">from</span> <span class="pl-s1">modelscope</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-k">from</span> <span class="pl-s1">modelscope</span> <span class="pl-k">import</span> <span class="pl-v">GenerationConfig</span> <span class="pl-c"># Model names: "qwen/Qwen-7B-Chat", "qwen/Qwen-14B-Chat"</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">fp16</span><span class="pl-c1">=</span><span class="pl-c1">True</span>).<span class="pl-c1">eval</span>() <span class="pl-s1">model</span>.<span class="pl-c1">generation_config</span> <span class="pl-c1">=</span> <span class="pl-v">GenerationConfig</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"Qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-c"># 可指定不同的生成长度、top_p等相关超参</span> <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"你好"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"浙江的省会在哪里?"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"它有什么好玩的景点"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>)</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Batch Inference</h3><a id="user-content-batch-inference" class="anchor" aria-label="Permalink: Batch Inference" href="#batch-inference"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Qwen supports batch inference. With flash attention enabled, using batch inference can bring a 40% speedup. The example code is shown below:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers import GenerationConfig from qwen_generation_utils import make_context, decode_tokens, get_stop_words_ids # To generate attention masks automatically, it is necessary to assign distinct # token_ids to pad_token and eos_token, and set pad_token_id in the generation_config. tokenizer = AutoTokenizer.from_pretrained( './', pad_token='<|extra_0|>', eos_token='<|endoftext|>', padding_side='left', trust_remote_code=True ) model = AutoModelForCausalLM.from_pretrained( './', pad_token_id=tokenizer.pad_token_id, device_map="auto", trust_remote_code=True ).eval() model.generation_config = GenerationConfig.from_pretrained('./', pad_token_id=tokenizer.pad_token_id) all_raw_text = ["我想听你说爱我。", "今天我想吃点啥,甜甜的,推荐下", "我马上迟到了,怎么做才能不迟到"] batch_raw_text = [] for q in all_raw_text: raw_text, _ = make_context( tokenizer, q, system="You are a helpful assistant.", max_window_size=model.generation_config.max_window_size, chat_format=model.generation_config.chat_format, ) batch_raw_text.append(raw_text) batch_input_ids = tokenizer(batch_raw_text, padding='longest') batch_input_ids = torch.LongTensor(batch_input_ids['input_ids']).to(model.device) batch_out_ids = model.generate( batch_input_ids, return_dict_in_generate=False, generation_config=model.generation_config ) padding_lens = [batch_input_ids[i].eq(tokenizer.pad_token_id).sum().item() for i in range(batch_input_ids.size(0))] batch_response = [ decode_tokens( batch_out_ids[i][padding_lens[i]:], tokenizer, raw_text_len=len(batch_raw_text[i]), context_length=(batch_input_ids[i].size(0)-padding_lens[i]), chat_format="chatml", verbose=False, errors='replace' ) for i in range(len(all_raw_text)) ] print(batch_response) response, _ = model.chat(tokenizer, "我想听你说爱我。", history=None) print(response) response, _ = model.chat(tokenizer, "今天我想吃点啥,甜甜的,推荐下", history=None) print(response) response, _ = model.chat(tokenizer, "我马上迟到了,怎么做才能不迟到", history=None) print(response)"><pre><span class="pl-k">import</span> <span class="pl-s1">torch</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">GenerationConfig</span> <span class="pl-k">from</span> <span class="pl-s1">qwen_generation_utils</span> <span class="pl-k">import</span> <span class="pl-s1">make_context</span>, <span class="pl-s1">decode_tokens</span>, <span class="pl-s1">get_stop_words_ids</span> <span class="pl-c"># To generate attention masks automatically, it is necessary to assign distinct</span> <span class="pl-c"># token_ids to pad_token and eos_token, and set pad_token_id in the generation_config.</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">'./'</span>, <span class="pl-s1">pad_token</span><span class="pl-c1">=</span><span class="pl-s">'<|extra_0|>'</span>, <span class="pl-s1">eos_token</span><span class="pl-c1">=</span><span class="pl-s">'<|endoftext|>'</span>, <span class="pl-s1">padding_side</span><span class="pl-c1">=</span><span class="pl-s">'left'</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ) <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">'./'</span>, <span class="pl-s1">pad_token_id</span><span class="pl-c1">=</span><span class="pl-s1">tokenizer</span>.<span class="pl-c1">pad_token_id</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-s1">model</span>.<span class="pl-c1">generation_config</span> <span class="pl-c1">=</span> <span class="pl-v">GenerationConfig</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">'./'</span>, <span class="pl-s1">pad_token_id</span><span class="pl-c1">=</span><span class="pl-s1">tokenizer</span>.<span class="pl-c1">pad_token_id</span>) <span class="pl-s1">all_raw_text</span> <span class="pl-c1">=</span> [<span class="pl-s">"我想听你说爱我。"</span>, <span class="pl-s">"今天我想吃点啥,甜甜的,推荐下"</span>, <span class="pl-s">"我马上迟到了,怎么做才能不迟到"</span>] <span class="pl-s1">batch_raw_text</span> <span class="pl-c1">=</span> [] <span class="pl-k">for</span> <span class="pl-s1">q</span> <span class="pl-c1">in</span> <span class="pl-s1">all_raw_text</span>: <span class="pl-s1">raw_text</span>, <span class="pl-s1">_</span> <span class="pl-c1">=</span> <span class="pl-en">make_context</span>( <span class="pl-s1">tokenizer</span>, <span class="pl-s1">q</span>, <span class="pl-s1">system</span><span class="pl-c1">=</span><span class="pl-s">"You are a helpful assistant."</span>, <span class="pl-s1">max_window_size</span><span class="pl-c1">=</span><span class="pl-s1">model</span>.<span class="pl-c1">generation_config</span>.<span class="pl-c1">max_window_size</span>, <span class="pl-s1">chat_format</span><span class="pl-c1">=</span><span class="pl-s1">model</span>.<span class="pl-c1">generation_config</span>.<span class="pl-c1">chat_format</span>, ) <span class="pl-s1">batch_raw_text</span>.<span class="pl-c1">append</span>(<span class="pl-s1">raw_text</span>) <span class="pl-s1">batch_input_ids</span> <span class="pl-c1">=</span> <span class="pl-en">tokenizer</span>(<span class="pl-s1">batch_raw_text</span>, <span class="pl-s1">padding</span><span class="pl-c1">=</span><span class="pl-s">'longest'</span>) <span class="pl-s1">batch_input_ids</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-c1">LongTensor</span>(<span class="pl-s1">batch_input_ids</span>[<span class="pl-s">'input_ids'</span>]).<span class="pl-c1">to</span>(<span class="pl-s1">model</span>.<span class="pl-c1">device</span>) <span class="pl-s1">batch_out_ids</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">generate</span>( <span class="pl-s1">batch_input_ids</span>, <span class="pl-s1">return_dict_in_generate</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">generation_config</span><span class="pl-c1">=</span><span class="pl-s1">model</span>.<span class="pl-c1">generation_config</span> ) <span class="pl-s1">padding_lens</span> <span class="pl-c1">=</span> [<span class="pl-s1">batch_input_ids</span>[<span class="pl-s1">i</span>].<span class="pl-c1">eq</span>(<span class="pl-s1">tokenizer</span>.<span class="pl-c1">pad_token_id</span>).<span class="pl-c1">sum</span>().<span class="pl-c1">item</span>() <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">batch_input_ids</span>.<span class="pl-c1">size</span>(<span class="pl-c1">0</span>))] <span class="pl-s1">batch_response</span> <span class="pl-c1">=</span> [ <span class="pl-en">decode_tokens</span>( <span class="pl-s1">batch_out_ids</span>[<span class="pl-s1">i</span>][<span class="pl-s1">padding_lens</span>[<span class="pl-s1">i</span>]:], <span class="pl-s1">tokenizer</span>, <span class="pl-s1">raw_text_len</span><span class="pl-c1">=</span><span class="pl-en">len</span>(<span class="pl-s1">batch_raw_text</span>[<span class="pl-s1">i</span>]), <span class="pl-s1">context_length</span><span class="pl-c1">=</span>(<span class="pl-s1">batch_input_ids</span>[<span class="pl-s1">i</span>].<span class="pl-c1">size</span>(<span class="pl-c1">0</span>)<span class="pl-c1">-</span><span class="pl-s1">padding_lens</span>[<span class="pl-s1">i</span>]), <span class="pl-s1">chat_format</span><span class="pl-c1">=</span><span class="pl-s">"chatml"</span>, <span class="pl-s1">verbose</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">errors</span><span class="pl-c1">=</span><span class="pl-s">'replace'</span> ) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-en">len</span>(<span class="pl-s1">all_raw_text</span>)) ] <span class="pl-en">print</span>(<span class="pl-s1">batch_response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">_</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"我想听你说爱我。"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">_</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"今天我想吃点啥,甜甜的,推荐下"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">_</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"我马上迟到了,怎么做才能不迟到"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>)</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">CPU</h3><a id="user-content-cpu" class="anchor" aria-label="Permalink: CPU" href="#cpu"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">To deploy our models on CPU, we strongly advise you to use <a href="https://github.com/QwenLM/qwen.cpp">qwen.cpp</a>, which is a pure C++ implementation of Qwen and tiktoken. Check the repo for more details!</p> <p dir="auto">Also, it is also simple to directly run the model on CPU, which requires your specification of device:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-7B-Chat", device_map="cpu", trust_remote_code=True).eval()"><pre><span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"Qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"cpu"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>).<span class="pl-c1">eval</span>()</pre></div> <p dir="auto">However, it is likely that you suffer from extremely low inference efficiency.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Multiple GPUs</h3><a id="user-content-multiple-gpus" class="anchor" aria-label="Permalink: Multiple GPUs" href="#multiple-gpus"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">If you suffer from lack of GPU memory and you would like to run the model on more than 1 GPU, you can directly use the default loading method, which is now supported by Transformers. The previous method based on <code>utils.py</code> is deprecated.</p> <p dir="auto">However, though this method is simple, the efficiency of the native pipeline parallelism is low. We advise you to use vLLM with FastChat and please read the section for deployment.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">x86 Platforms</h3><a id="user-content-x86-platforms" class="anchor" aria-label="Permalink: x86 Platforms" href="#x86-platforms"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">When deploy on Core™/Xeon® Scalable Processors or with Arc™ GPU, <a href="https://docs.openvino.ai/2023.3/gen_ai_guide.html" rel="nofollow">OpenVINO™ Toolkit</a> is recommended. You can install and run this <a href="https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/254-llm-chatbot">example notebook</a>. For related issues, you are welcome to file an issue at <a href="https://github.com/openvinotoolkit/openvino_notebooks/issues">OpenVINO repo</a>.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">DashScope</h3><a id="user-content-dashscope" class="anchor" aria-label="Permalink: DashScope" href="#dashscope"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The most simple way to use Qwen through APIs is DashScope API service through Alibaba Cloud. We give an introduction to the usage. Additionally, we provide a script for you to deploy an OpenAI-style API on your own servers.</p> <p dir="auto">DashScope is the large language model API service provided by Alibaba Cloud, which now supports Qwen. Note that the models behind DashScope are in-house versions temporarily without details provided. The services include <code>qwen-turbo</code> and <code>qwen-plus</code>, where the former one runs faster and the latter achieves better performance. For more information, visit the documentation <a href="https://dashscope.aliyun.com" rel="nofollow">here</a>.</p> <p dir="auto">Please head to the official website <a href="https://help.aliyun.com/zh/dashscope/developer-reference/activate-dashscope-and-create-an-api-key?spm=a2c4g.11186623.0.0.6c2774fahtfXdn" rel="nofollow">link</a> to create a DashScope account and obtain the API key (AK). We recommend setting the AK with an environment variable:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export DASHSCOPE_API_KEY="YOUR_DASHSCOPE_API_KEY""><pre><span class="pl-k">export</span> DASHSCOPE_API_KEY=<span class="pl-s"><span class="pl-pds">"</span>YOUR_DASHSCOPE_API_KEY<span class="pl-pds">"</span></span></pre></div> <p dir="auto">Then please install the packages and click <a href="https://help.aliyun.com/zh/dashscope/developer-reference/install-dashscope-sdk" rel="nofollow">here</a> for the documentation. If you use Python, you can install DashScope with pip:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install dashscope"><pre>pip install dashscope</pre></div> <p dir="auto">If you use JAVA SDK, you can install it in this way:</p> <div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="<!-- https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java --> <dependency> <groupId>com.alibaba</groupId> <artifactId>dashscope-sdk-java</artifactId> <version>the-latest-version</version> </dependency>"><pre><span class="pl-c"><span class="pl-c"><!--</span> https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java <span class="pl-c">--></span></span> <<span class="pl-ent">dependency</span>> <<span class="pl-ent">groupId</span>>com.alibaba</<span class="pl-ent">groupId</span>> <<span class="pl-ent">artifactId</span>>dashscope-sdk-java</<span class="pl-ent">artifactId</span>> <<span class="pl-ent">version</span>>the-latest-version</<span class="pl-ent">version</span>> </<span class="pl-ent">dependency</span>></pre></div> <p dir="auto">The simplest way to use DashScope is the usage with messages, which is similar to OpenAI API. The example is demonstrated below:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import random from http import HTTPStatus from dashscope import Generation def call_with_messages(): messages = [{'role': 'system', 'content': 'You are a helpful assistant.'}, {'role': 'user', 'content': '如何做西红柿鸡蛋?'}] gen = Generation() response = gen.call( Generation.Models.qwen_turbo, messages=messages, seed=random.randint(1, 10000), # set the random seed, optional, default to 1234 if not set result_format='message', # set the result to be "message" format. ) return response if __name__ == '__main__': response = call_with_messages() if response.status_code == HTTPStatus.OK: print(response) else: print('Request id: %s, Status code: %s, error code: %s, error message: %s' % ( response.request_id, response.status_code, response.code, response.message ))"><pre><span class="pl-k">import</span> <span class="pl-s1">random</span> <span class="pl-k">from</span> <span class="pl-s1">http</span> <span class="pl-k">import</span> <span class="pl-v">HTTPStatus</span> <span class="pl-k">from</span> <span class="pl-s1">dashscope</span> <span class="pl-k">import</span> <span class="pl-v">Generation</span> <span class="pl-k">def</span> <span class="pl-en">call_with_messages</span>(): <span class="pl-s1">messages</span> <span class="pl-c1">=</span> [{<span class="pl-s">'role'</span>: <span class="pl-s">'system'</span>, <span class="pl-s">'content'</span>: <span class="pl-s">'You are a helpful assistant.'</span>}, {<span class="pl-s">'role'</span>: <span class="pl-s">'user'</span>, <span class="pl-s">'content'</span>: <span class="pl-s">'如何做西红柿鸡蛋?'</span>}] <span class="pl-s1">gen</span> <span class="pl-c1">=</span> <span class="pl-en">Generation</span>() <span class="pl-s1">response</span> <span class="pl-c1">=</span> <span class="pl-s1">gen</span>.<span class="pl-c1">call</span>( <span class="pl-v">Generation</span>.<span class="pl-c1">Models</span>.<span class="pl-c1">qwen_turbo</span>, <span class="pl-s1">messages</span><span class="pl-c1">=</span><span class="pl-s1">messages</span>, <span class="pl-s1">seed</span><span class="pl-c1">=</span><span class="pl-s1">random</span>.<span class="pl-c1">randint</span>(<span class="pl-c1">1</span>, <span class="pl-c1">10000</span>), <span class="pl-c"># set the random seed, optional, default to 1234 if not set</span> <span class="pl-s1">result_format</span><span class="pl-c1">=</span><span class="pl-s">'message'</span>, <span class="pl-c"># set the result to be "message" format.</span> ) <span class="pl-k">return</span> <span class="pl-s1">response</span> <span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">'__main__'</span>: <span class="pl-s1">response</span> <span class="pl-c1">=</span> <span class="pl-en">call_with_messages</span>() <span class="pl-k">if</span> <span class="pl-s1">response</span>.<span class="pl-c1">status_code</span> <span class="pl-c1">==</span> <span class="pl-v">HTTPStatus</span>.<span class="pl-c1">OK</span>: <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-k">else</span>: <span class="pl-en">print</span>(<span class="pl-s">'Request id: %s, Status code: %s, error code: %s, error message: %s'</span> <span class="pl-c1">%</span> ( <span class="pl-s1">response</span>.<span class="pl-c1">request_id</span>, <span class="pl-s1">response</span>.<span class="pl-c1">status_code</span>, <span class="pl-s1">response</span>.<span class="pl-c1">code</span>, <span class="pl-s1">response</span>.<span class="pl-c1">message</span> ))</pre></div> <p dir="auto">For more usages, please visit the official website for more details. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Quantization</h2><a id="user-content-quantization" class="anchor" aria-label="Permalink: Quantization" href="#quantization"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">GPTQ</h3><a id="user-content-gptq" class="anchor" aria-label="Permalink: GPTQ" href="#gptq"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We provide a solution based on <a href="https://github.com/PanQiWei/AutoGPTQ">AutoGPTQ</a>, and release the Int4 and Int8 quantized models, which achieve nearly lossless model effects but improved performance on both memory costs and inference speed.</p> <p dir="auto">Here we demonstrate how to use our provided quantized models for inference. Before you start, make sure you meet the requirements of auto-gptq (e.g., torch 2.0 and above, transformers 4.32.0 and above, etc.) and install the required packages:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install auto-gptq optimum"><pre>pip install auto-gptq optimum</pre></div> <p dir="auto">If you meet problems installing <code>auto-gptq</code>, we advise you to check out the official <a href="https://github.com/PanQiWei/AutoGPTQ">repo</a> to find a wheel.</p> <blockquote> <p dir="auto">Note: The pre-compiled <code>auto-gptq</code> packages strongly depend on the version of <code>torch</code> and its CUDA version. Moreover, due to recent update, you may also encounter unsupported version errors from <code>transformers</code>, <code>optimum</code>, or <code>peft</code>. We recommend using the latest versions meeting the following requirements:</p> <ul dir="auto"> <li>torch==2.1 auto-gptq>=0.5.1 transformers>=4.35.0 optimum>=1.14.0 peft>=0.6.1</li> <li>torch>=2.0,<2.1 auto-gptq<0.5.0 transformers<4.35.0 optimum<1.14.0 peft>=0.5.0,<0.6.0</li> </ul> </blockquote> <p dir="auto">Then you can load the quantized model easily and run inference as same as usual:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Model names: "Qwen/Qwen-7B-Chat-Int4", "Qwen/Qwen-14B-Chat-Int4" model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen-7B-Chat-Int4", device_map="auto", trust_remote_code=True ).eval() response, history = model.chat(tokenizer, "Hi", history=None)"><pre><span class="pl-c"># Model names: "Qwen/Qwen-7B-Chat-Int4", "Qwen/Qwen-14B-Chat-Int4"</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">"Qwen/Qwen-7B-Chat-Int4"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"Hi"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>)</pre></div> <p dir="auto">We illustrate the model performance of both BF16, Int8 and Int4 models on the benchmark, and we find that the quantized model does not suffer from significant performance degradation. Results are shown below:</p> <markdown-accessiblity-table><table> <thead> <tr> <th>Quantization</th> <th align="center">MMLU</th> <th align="center">CEval (val)</th> <th align="center">GSM8K</th> <th align="center">Humaneval</th> </tr> </thead> <tbody> <tr> <td>Qwen-1.8B-Chat (BF16)</td> <td align="center">43.3</td> <td align="center">55.6</td> <td align="center">33.7</td> <td align="center">26.2</td> </tr> <tr> <td>Qwen-1.8B-Chat (Int8)</td> <td align="center">43.1</td> <td align="center">55.8</td> <td align="center">33.0</td> <td align="center">27.4</td> </tr> <tr> <td>Qwen-1.8B-Chat (Int4)</td> <td align="center">42.9</td> <td align="center">52.8</td> <td align="center">31.2</td> <td align="center">25.0</td> </tr> <tr> <td>Qwen-7B-Chat (BF16)</td> <td align="center">55.8</td> <td align="center">59.7</td> <td align="center">50.3</td> <td align="center">37.2</td> </tr> <tr> <td>Qwen-7B-Chat (Int8)</td> <td align="center">55.4</td> <td align="center">59.4</td> <td align="center">48.3</td> <td align="center">34.8</td> </tr> <tr> <td>Qwen-7B-Chat (Int4)</td> <td align="center">55.1</td> <td align="center">59.2</td> <td align="center">49.7</td> <td align="center">29.9</td> </tr> <tr> <td>Qwen-14B-Chat (BF16)</td> <td align="center">64.6</td> <td align="center">69.8</td> <td align="center">60.1</td> <td align="center">43.9</td> </tr> <tr> <td>Qwen-14B-Chat (Int8)</td> <td align="center">63.6</td> <td align="center">68.6</td> <td align="center">60.0</td> <td align="center">48.2</td> </tr> <tr> <td>Qwen-14B-Chat (Int4)</td> <td align="center">63.3</td> <td align="center">69.0</td> <td align="center">59.8</td> <td align="center">45.7</td> </tr> <tr> <td>Qwen-72B-Chat (BF16)</td> <td align="center">74.4</td> <td align="center">80.1</td> <td align="center">76.4</td> <td align="center">64.6</td> </tr> <tr> <td>Qwen-72B-Chat (Int8)</td> <td align="center">73.5</td> <td align="center">80.1</td> <td align="center">73.5</td> <td align="center">62.2</td> </tr> <tr> <td>Qwen-72B-Chat (Int4)</td> <td align="center">73.4</td> <td align="center">80.1</td> <td align="center">75.3</td> <td align="center">61.6</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Quantization of KV cache</h3><a id="user-content-quantization-of-kv-cache" class="anchor" aria-label="Permalink: Quantization of KV cache" href="#quantization-of-kv-cache"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">NOTE: Please be aware that due to the internal mechanism of Hugging Face, the support files for this functionality (i.e., <code>cache_autogptq_cuda_256.cpp</code> and <code>cache_autogptq_cuda_kernel_256.cu</code>) may be missing. Please manually download them from the Hugging Face Hub and place them into the same folder as the other module files.</p> </blockquote> <p dir="auto">The attention KV cache can be quantized and compressed for storage, to get a higher sample throughput. The arguments <code>use_cache_quantization</code> and <code>use_cache_kernel</code> in <code>config.json</code> are provided to enable KV cache quantization. The specific use method is as follows:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True, use_cache_quantization=True, use_cache_kernel=True, use_flash_attn=False )"><pre><span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">"Qwen/Qwen-7B-Chat"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">use_cache_quantization</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">use_cache_kernel</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">use_flash_attn</span><span class="pl-c1">=</span><span class="pl-c1">False</span> )</pre></div> <p dir="auto">Attention: Currently, KV cache quantization and flash attention cannot be used at the same time. If you enable KV cache quantization and flash attention at the same time (<code>use_flash_attn=True</code>, <code>use_cache_quantization=True</code>, <code>use_cache_kernel=True</code>), <code>use_flash_attn</code> is disabled by default (<code>use_flash_attn=false</code>).</p> <p dir="auto">We have verified that the use of the quantized Int8-KV-Cache model does not suffer from significant performance degradation in downstream evaluation. In the following, we focus on profiling its memory footprint in different conditions. The profiling runs on a single A100-SXM4-80G GPU with PyTorch 2.0.1 and CUDA 11.4. We use BF16 models to generate 1024 tokens by default, and "OOM" indicates out-of-memory error.</p> <p dir="auto">With KV cache quantization, the model can infer with a larger batch size (bs).</p> <markdown-accessiblity-table><table> <thead> <tr> <th>USE KV Cache</th> <th align="center">bs=1</th> <th align="center">bs=4</th> <th align="center">bs=16</th> <th align="center">bs=32</th> <th align="center">bs=64</th> <th align="center">bs=100</th> </tr> </thead> <tbody> <tr> <td>No</td> <td align="center">16.3GB</td> <td align="center">24.1GB</td> <td align="center">31.7GB</td> <td align="center">48.7GB</td> <td align="center">OOM</td> <td align="center">OOM</td> </tr> <tr> <td>Yes</td> <td align="center">15.5GB</td> <td align="center">17.2GB</td> <td align="center">22.3GB</td> <td align="center">30.2GB</td> <td align="center">48.2GB</td> <td align="center">72.4GB</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">With KV cache quantization the model can save more memory when generating longer sequence (<code>sl</code>, sequence length, referring to the number of tokens generated) at the stage of inference.</p> <markdown-accessiblity-table><table> <thead> <tr> <th>USE KV Cache</th> <th align="center">sl=512</th> <th align="center">sl=1024</th> <th align="center">sl=2048</th> <th align="center">sl=4096</th> <th align="center">sl=8192</th> </tr> </thead> <tbody> <tr> <td>No</td> <td align="center">15.2GB</td> <td align="center">16.3GB</td> <td align="center">17.6GB</td> <td align="center">19.5GB</td> <td align="center">23.2GB</td> </tr> <tr> <td>Yes</td> <td align="center">15GB</td> <td align="center">15.5GB</td> <td align="center">15.8GB</td> <td align="center">16.6GB</td> <td align="center">17.6GB</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">The model with KV cache quantization will convert the format of <code>layer_past</code> from float to int8, and meanwhile the quantized <code>layer-past</code> will also store the quantization parameters.</p> <p dir="auto">Specific steps are as follows:</p> <ol dir="auto"> <li>Quantize key/value</li> </ol> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" qv,scale,zero_point=quantize_cache_v(v)"><pre class="notranslate"><code> qv,scale,zero_point=quantize_cache_v(v) </code></pre></div> <ol start="2" dir="auto"> <li>Store into layer_past</li> </ol> <p dir="auto">The following is the format of quantized <code>layer_past</code>:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" layer_past=((q_key,key_scale,key_zero_point), (q_value,value_scale,value_zero_point))"><pre class="notranslate"><code> layer_past=((q_key,key_scale,key_zero_point), (q_value,value_scale,value_zero_point)) </code></pre></div> <p dir="auto">The original format of <code>layer_past</code> is shown below:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" layer_past=(key,value)"><pre class="notranslate"><code> layer_past=(key,value) </code></pre></div> <p dir="auto">If you want to use the attention KV which is quantized, you can use the dequantization operation to convert the Int8 key/value back to the float format as follows:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" v=dequantize_cache_torch(qv,scale,zero_point)"><pre class="notranslate"><code> v=dequantize_cache_torch(qv,scale,zero_point) </code></pre></div> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Inference Performance</h2><a id="user-content-inference-performance" class="anchor" aria-label="Permalink: Inference Performance" href="#inference-performance"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">This section provides the statistics of speed and memory of models in different precisions. The speed and memory profiling are conducted using <a href="https://qianwen-res.oss-cn-beijing.aliyuncs.com/profile.py" rel="nofollow">this script</a>.</p> <p dir="auto">We measured the average inference speed (tokens/s) and GPU memory usage of generating 2048 with the models in BF16, Int8, and Int4.</p> <markdown-accessiblity-table><table> <tbody><tr> <td>Model Size</td> <td>Quantization</td> <td>Speed (Tokens/s)</td> <td>GPU Memory Usage</td> </tr> <tr> <td rowspan="3">1.8B</td> <td>BF16</td> <td>54.09</td> <td>4.23GB</td> </tr> <tr> <td>Int8</td> <td>55.56</td> <td>3.48GB</td> </tr> <tr> <td>Int4</td> <td>71.07</td> <td>2.91GB</td> </tr> <tr> <td rowspan="3">7B</td> <td>BF16</td> <td>40.93</td> <td>16.99GB</td> </tr> <tr> <td>Int8</td> <td>37.47</td> <td>11.20GB</td> </tr> <tr> <td>Int4</td> <td>50.09</td> <td>8.21GB</td> </tr> <tr> <td rowspan="3">14B</td> <td>BF16</td> <td>32.22</td> <td>30.15GB</td> </tr> <tr> <td>Int8</td> <td>29.28</td> <td>18.81GB</td> </tr> <tr> <td>Int4</td> <td>38.72</td> <td>13.01GB</td> </tr> <tr> <td rowspan="3">72B</td> <td>BF16</td> <td>8.48</td> <td>144.69GB (2xA100)</td> </tr> <tr> <td>Int8</td> <td>9.05</td> <td>81.27GB (2xA100)</td> </tr> <tr> <td>Int4</td> <td>11.32</td> <td>48.86GB</td> </tr> <tr> <td>72B + vLLM</td> <td>BF16</td> <td>17.60</td> <td>2xA100</td> </tr> </tbody></table></markdown-accessiblity-table> <p dir="auto">The profiling runs on a single A100-SXM4-80G GPU (except 2xA100 is mentioned) with PyTorch 2.0.1, CUDA 11.8, and Flash-Attention 2. (72B + vLLM uses PyTorch 2.1.0 and Cuda 11.8.) The inference speed is averaged over the encoded and generated tokens.</p> <p dir="auto">Note: The generation speed of the Int4/Int8 models mentioned above is provided by the autogptq library. The current speed of the model loaded using <code>AutoModelForCausalLM.from_pretrained</code> will be approximately 20% slower. We have reported this issue to the HuggingFace team and will update it promptly if a solution is available.</p> <p dir="auto">We also measure the inference speed and GPU memory usage with different settings of context and generation lengths, Flash-Attention version. You can find the results in the according modelcards on Hugging Face or ModelScope.</p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Finetuning</h2><a id="user-content-finetuning" class="anchor" aria-label="Permalink: Finetuning" href="#finetuning"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Usage</h3><a id="user-content-usage" class="anchor" aria-label="Permalink: Usage" href="#usage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Now we provide the official training script, <code>finetune.py</code>, for users to finetune the pretrained model for downstream applications in a simple fashion. Additionally, we provide shell scripts to launch finetuning with no worries. This script supports the training with <a href="https://github.com/microsoft/DeepSpeed">DeepSpeed</a> and <a href="https://engineering.fb.com/2021/07/15/open-source/fsdp/" rel="nofollow">FSDP</a>. The shell scripts that we provide use DeepSpeed (Note: this may have conflicts with the latest version of pydantic and you should use make sure <code>pydantic<2.0</code>) and Peft. You can install them by:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install "peft<0.8.0" deepspeed"><pre>pip install <span class="pl-s"><span class="pl-pds">"</span>peft<0.8.0<span class="pl-pds">"</span></span> deepspeed</pre></div> <p dir="auto">To prepare your training data, you need to put all the samples into a list and save it to a json file. Each sample is a dictionary consisting of an id and a list for conversation. Below is a simple example list with 1 sample:</p> <div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[ { "id": "identity_0", "conversations": [ { "from": "user", "value": "你好" }, { "from": "assistant", "value": "我是一个语言模型,我叫通义千问。" } ] } ]"><pre>[ { <span class="pl-ent">"id"</span>: <span class="pl-s"><span class="pl-pds">"</span>identity_0<span class="pl-pds">"</span></span>, <span class="pl-ent">"conversations"</span>: [ { <span class="pl-ent">"from"</span>: <span class="pl-s"><span class="pl-pds">"</span>user<span class="pl-pds">"</span></span>, <span class="pl-ent">"value"</span>: <span class="pl-s"><span class="pl-pds">"</span>你好<span class="pl-pds">"</span></span> }, { <span class="pl-ent">"from"</span>: <span class="pl-s"><span class="pl-pds">"</span>assistant<span class="pl-pds">"</span></span>, <span class="pl-ent">"value"</span>: <span class="pl-s"><span class="pl-pds">"</span>我是一个语言模型,我叫通义千问。<span class="pl-pds">"</span></span> } ] } ]</pre></div> <p dir="auto">After data preparation, you can use the provided shell scripts to run finetuning. Remember to specify the path to the data file, <code>$DATA</code>.</p> <p dir="auto">The finetuning scripts allow you to perform:</p> <ul dir="auto"> <li>Full-parameter finetuning</li> <li>LoRA</li> <li>Q-LoRA</li> </ul> <p dir="auto">Full-parameter finetuning requires updating all parameters in the whole training process. To launch your training, run the following script:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Distributed training. We do not provide single-GPU training script as the insufficient GPU memory will break down the training. bash finetune/finetune_ds.sh"><pre><span class="pl-c"><span class="pl-c">#</span> Distributed training. We do not provide single-GPU training script as the insufficient GPU memory will break down the training.</span> bash finetune/finetune_ds.sh</pre></div> <p dir="auto">Remember to specify the correct model name or path, the data path, as well as the output directory in the shell scripts. Another thing to notice is that we use DeepSpeed ZeRO 3 in this script. If you want to make changes, just remove the argument <code>--deepspeed</code> or make changes in the DeepSpeed configuration json file based on your requirements. Additionally, this script supports mixed-precision training, and thus you can use <code>--bf16 True</code> or <code>--fp16 True</code>. Remember to use DeepSpeed when you use fp16 due to mixed precision training. Empirically we advise you to use bf16 to make your training consistent with our pretraining and alignment if your machine supports bf16, and thus we use it by default.</p> <p dir="auto">Similarly, to run LoRA, use another script to run as shown below. Before you start, make sure that you have installed <code>peft</code>. Also, you need to specify your paths to your model, data, and output. We advise you to use absolute path for your pretrained model. This is because LoRA only saves the adapter and the absolute path in the adapter configuration json file is used for finding out the pretrained model to load. Also, this script support both bf16 and fp16.</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Single GPU training bash finetune/finetune_lora_single_gpu.sh # Distributed training bash finetune/finetune_lora_ds.sh"><pre><span class="pl-c"><span class="pl-c">#</span> Single GPU training</span> bash finetune/finetune_lora_single_gpu.sh <span class="pl-c"><span class="pl-c">#</span> Distributed training</span> bash finetune/finetune_lora_ds.sh</pre></div> <p dir="auto">In comparison with full-parameter finetuning, LoRA (<a href="https://arxiv.org/abs/2106.09685" rel="nofollow">paper</a>) only updates the parameters of adapter layers but keeps the original large language model layers frozen. This allows much fewer memory costs and thus fewer computation costs.</p> <p dir="auto">Note that if you use LoRA to finetune the base language model, e.g., Qwen-7B, instead of chat models, e.g., Qwen-7B-Chat, the script automatically switches the embedding and output layer as trainable parameters. This is because the base language model has no knowledge of special tokens brought by ChatML format. Thus these layers should be updated for the model to understand and predict the tokens. Or in another word, if your training brings in special tokens in LoRA, you should set the layers to trainable parameters by setting <code>modules_to_save</code> inside the code. Also, if we have these parameters trainable, it is not available to use ZeRO 3, and this is why we use ZeRO 2 in the script by default. If you do not have new trainable parameters, you can switch to ZeRO 3 by changing the DeepSpeed configuration file. Additionally, we find that there is a significant gap between the memory footprint of LoRA with and without these trainable parameters. Therefore, if you have trouble with memory, we advise you to LoRA finetune the chat models. Check the profile below for more information.</p> <p dir="auto">If you still suffer from insufficient memory, you can consider Q-LoRA (<a href="https://arxiv.org/abs/2305.14314" rel="nofollow">paper</a>), which uses the quantized large language model and other techniques such as paged attention to allow even fewer memory costs.</p> <p dir="auto">Note: to run single-GPU Q-LoRA training, you may need to install <code>mpi4py</code> through <code>pip</code> or <code>conda</code>.</p> <p dir="auto">To run Q-LoRA, directly run the following script:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Single GPU training bash finetune/finetune_qlora_single_gpu.sh # Distributed training bash finetune/finetune_qlora_ds.sh"><pre><span class="pl-c"><span class="pl-c">#</span> Single GPU training</span> bash finetune/finetune_qlora_single_gpu.sh <span class="pl-c"><span class="pl-c">#</span> Distributed training</span> bash finetune/finetune_qlora_ds.sh</pre></div> <p dir="auto">For Q-LoRA, we advise you to load our provided quantized model, e.g., Qwen-7B-Chat-Int4. You <strong>SHOULD NOT</strong> use the bf16 models. Different from full-parameter finetuning and LoRA, only fp16 is supported for Q-LoRA. For single-GPU training, we have to use DeepSpeed for mixed-precision training due to our observation of errors caused by torch amp. Besides, for Q-LoRA, the troubles with the special tokens in LoRA still exist. However, as we only provide the Int4 models for chat models, which means the language model has learned the special tokens of ChatML format, you have no worry about the layers. Note that the layers of the Int4 model should not be trainable, and thus if you introduce special tokens in your training, Q-LoRA might not work.</p> <blockquote> <p dir="auto">NOTE: Please be aware that due to the internal mechanisms of Hugging Face, certain non-Python files (e.g., <code>*.cpp</code> and <code>*.cu</code>) may be missing from the saved checkpoint. You may need to manually copy them to the directory containing other files.</p> </blockquote> <p dir="auto">Different from full-parameter finetuning, the training of both LoRA and Q-LoRA only saves the adapter parameters. Suppose your training starts from Qwen-7B, you can load the finetuned model for inference as shown below:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from peft import AutoPeftModelForCausalLM model = AutoPeftModelForCausalLM.from_pretrained( path_to_adapter, # path to the output directory device_map="auto", trust_remote_code=True ).eval()"><pre><span class="pl-k">from</span> <span class="pl-s1">peft</span> <span class="pl-k">import</span> <span class="pl-v">AutoPeftModelForCausalLM</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoPeftModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s1">path_to_adapter</span>, <span class="pl-c"># path to the output directory</span> <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>()</pre></div> <blockquote> <p dir="auto">NOTE: If <code>peft>=0.8.0</code>, it will try to load the tokenizer as well, however, initialized without <code>trust_remote_code=True</code>, leading to <code>ValueError: Tokenizer class QWenTokenizer does not exist or is not currently imported.</code> Currently, you could downgrade <code>peft<0.8.0</code> or move tokenizer files elsewhere to workaround this issue.</p> </blockquote> <p dir="auto">If you want to merge the adapters and save the finetuned model as a standalone model (you can only do this with LoRA, and you CANNOT merge the parameters from Q-LoRA), you can run the following codes:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from peft import AutoPeftModelForCausalLM model = AutoPeftModelForCausalLM.from_pretrained( path_to_adapter, # path to the output directory device_map="auto", trust_remote_code=True ).eval() merged_model = model.merge_and_unload() # max_shard_size and safe serialization are not necessary. # They respectively work for sharding checkpoint and save the model to safetensors merged_model.save_pretrained(new_model_directory, max_shard_size="2048MB", safe_serialization=True)"><pre><span class="pl-k">from</span> <span class="pl-s1">peft</span> <span class="pl-k">import</span> <span class="pl-v">AutoPeftModelForCausalLM</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoPeftModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s1">path_to_adapter</span>, <span class="pl-c"># path to the output directory</span> <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-s1">merged_model</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">merge_and_unload</span>() <span class="pl-c"># max_shard_size and safe serialization are not necessary. </span> <span class="pl-c"># They respectively work for sharding checkpoint and save the model to safetensors</span> <span class="pl-s1">merged_model</span>.<span class="pl-c1">save_pretrained</span>(<span class="pl-s1">new_model_directory</span>, <span class="pl-s1">max_shard_size</span><span class="pl-c1">=</span><span class="pl-s">"2048MB"</span>, <span class="pl-s1">safe_serialization</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div> <p dir="auto">The <code>new_model_directory</code> directory will contain the merged model weights and module files. Please note that <code>*.cu</code> and <code>*.cpp</code> files may be missing in the saved files. If you wish to use the KV cache functionality, please manually copy them. Besides, the tokenizer files are not saved in the new directory in this step. You can copy the tokenizer files or use the following code</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained( path_to_adapter, # path to the output directory trust_remote_code=True ) tokenizer.save_pretrained(new_model_directory)"><pre><span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoTokenizer</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s1">path_to_adapter</span>, <span class="pl-c"># path to the output directory</span> <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ) <span class="pl-s1">tokenizer</span>.<span class="pl-c1">save_pretrained</span>(<span class="pl-s1">new_model_directory</span>)</pre></div> <p dir="auto">Note: For multi-GPU training, you need to specify the proper hyperparameters for distributed training based on your machine. Besides, we advise you to specify your maximum sequence length with the argument <code>--model_max_length</code>, based on your consideration of data, memory footprint, and training speed.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Quantize Fine-tuned Models</h3><a id="user-content-quantize-fine-tuned-models" class="anchor" aria-label="Permalink: Quantize Fine-tuned Models" href="#quantize-fine-tuned-models"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">This section applies to full-parameter/LoRA fine-tuned models. (Note: You do not need to quantize the Q-LoRA fine-tuned model because it is already quantized.) If you use LoRA, please follow the above instructions to merge your model before quantization.</p> <p dir="auto">We recommend using <a href="https://github.com/PanQiWei/AutoGPTQ">auto_gptq</a> to quantize the finetuned model.</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install auto-gptq optimum"><pre>pip install auto-gptq optimum</pre></div> <p dir="auto">Note: Currently AutoGPTQ has a bug referred in <a href="https://github.com/PanQiWei/AutoGPTQ/issues/370" data-hovercard-type="issue" data-hovercard-url="/AutoGPTQ/AutoGPTQ/issues/370/hovercard">this issue</a>. Here is a <a href="https://github.com/PanQiWei/AutoGPTQ/pull/495" data-hovercard-type="pull_request" data-hovercard-url="/AutoGPTQ/AutoGPTQ/pull/495/hovercard">workaround PR</a>, and you can pull this branch and install from the source.</p> <p dir="auto">First, prepare the calibration data. You can reuse the fine-tuning data, or use other data following the same format.</p> <p dir="auto">Second, run the following script:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python run_gptq.py \ --model_name_or_path $YOUR_LORA_MODEL_PATH \ --data_path $DATA \ --out_path $OUTPUT_PATH \ --bits 4 # 4 for int4; 8 for int8"><pre>python run_gptq.py \ --model_name_or_path <span class="pl-smi">$YOUR_LORA_MODEL_PATH</span> \ --data_path <span class="pl-smi">$DATA</span> \ --out_path <span class="pl-smi">$OUTPUT_PATH</span> \ --bits 4 <span class="pl-c"><span class="pl-c">#</span> 4 for int4; 8 for int8</span></pre></div> <p dir="auto">This step requires GPUs and may costs a few hours according to your data size and model size.</p> <p dir="auto">Then, copy all <code>*.py</code>, <code>*.cu</code>, <code>*.cpp</code> files and <code>generation_config.json</code> to the output path. And we recommend you to overwrite <code>config.json</code> by copying the file from the coresponding official quantized model (for example, if you are fine-tuning <code>Qwen-7B-Chat</code> and use <code>--bits 4</code>, you can find the <code>config.json</code> from <a href="https://huggingface.co/Qwen/Qwen-7B-Chat-Int4/blob/main/config.json" rel="nofollow">Qwen-7B-Chat-Int4</a>). You should also rename the <code>gptq.safetensors</code> into <code>model.safetensors</code>.</p> <p dir="auto">Finally, test the model by the same method to load the official quantized model. For example,</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.generation import GenerationConfig tokenizer = AutoTokenizer.from_pretrained("/path/to/your/model", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( "/path/to/your/model", device_map="auto", trust_remote_code=True ).eval() response, history = model.chat(tokenizer, "你好", history=None) print(response)"><pre><span class="pl-k">from</span> <span class="pl-s1">transformers</span> <span class="pl-k">import</span> <span class="pl-v">AutoModelForCausalLM</span>, <span class="pl-v">AutoTokenizer</span> <span class="pl-k">from</span> <span class="pl-s1">transformers</span>.<span class="pl-s1">generation</span> <span class="pl-k">import</span> <span class="pl-v">GenerationConfig</span> <span class="pl-s1">tokenizer</span> <span class="pl-c1">=</span> <span class="pl-v">AutoTokenizer</span>.<span class="pl-c1">from_pretrained</span>(<span class="pl-s">"/path/to/your/model"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-v">AutoModelForCausalLM</span>.<span class="pl-c1">from_pretrained</span>( <span class="pl-s">"/path/to/your/model"</span>, <span class="pl-s1">device_map</span><span class="pl-c1">=</span><span class="pl-s">"auto"</span>, <span class="pl-s1">trust_remote_code</span><span class="pl-c1">=</span><span class="pl-c1">True</span> ).<span class="pl-c1">eval</span>() <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">tokenizer</span>, <span class="pl-s">"你好"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>)</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Multinode Finetuning</h3><a id="user-content-multinode-finetuning" class="anchor" aria-label="Permalink: Multinode Finetuning" href="#multinode-finetuning"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Our provided scripts support multinode finetuning. You can refer to the comments in <a href="/QwenLM/Qwen/blob/main/finetune/finetune_lora_ds.sh">script</a> to correctly set corresponding arguments and launch the script on each node. For more information about multinode distributed training, please refer to <a href="https://pytorch.org/docs/stable/elastic/run.html" rel="nofollow">torchrun</a>.</p> <p dir="auto">Note: DeepSpeed ZeRO 3 requires much greater inter-node communication rate than ZeRO 2, which will significantly reduce the training speed in the case of multinode finetuning. Therefore, we do not recommend using DeepSpeed ZeRO 3 configurations in multinode finetuning scripts.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Profiling of Memory and Speed</h3><a id="user-content-profiling-of-memory-and-speed" class="anchor" aria-label="Permalink: Profiling of Memory and Speed" href="#profiling-of-memory-and-speed"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We profile the GPU memory and training speed of both LoRA (LoRA (emb) refers to training the embedding and output layer, while LoRA has no trainable embedding and output layer) and Q-LoRA in the setup of single-GPU training. In this test, we experiment on a single A100-SXM4-80G GPU, and we use CUDA 11.8 and Pytorch 2.0. Flash attention 2 is applied. We uniformly use a batch size of 1 and gradient accumulation of 8. We profile the memory (GB) and speed (s/iter) of inputs of different lengths, namely 256, 512, 1024, 2048, 4096, and 8192. We also report the statistics of full-parameter finetuning with Qwen-7B on 2 A100 GPUs. We only report the statistics of 256, 512, and 1024 tokens due to the limitation of GPU memory.</p> <p dir="auto">For Qwen-7B, we also test the performance of multinode finetuning. We experiment using two servers, each containing two A100-SXM4-80G GPUs, and the rest of configurations are the same as other Qwen-7B experiments. The results of multinode finetuning are marked as LoRA (multinode) in the table.</p> <p dir="auto">For Qwen-72B, we experiment in two ways: 1) Lora fintuning + DeepSpeed ZeRO 3 on 4 A100-SXM4-80G GPUs and 2) QLora (int4) fine-tuning on a single A100-SXM4-80G GPU. Note that OOM occurs on 4 A100-SXM4-80G GPUs both with LoRA (emb) fine-tuning and LoRA fine-tuning without Deepspeed ZeRO 3 (you can pass <code>--deepspeed finetune/ds_config_zero3.json</code> to <a href="/QwenLM/Qwen/blob/main/finetune/finetune_lora_ds.sh"><code>finetune/finetune_lora_ds.sh</code></a> to enable DeepSpeed ZeRO 3).</p> <p dir="auto">The statistics are listed below:</p> <markdown-accessiblity-table><table> <tbody><tr> <th rowspan="2">Model Size</th><th rowspan="2">Method</th><th rowspan="2">#Nodes</th><th rowspan="2">#GPUs per node</th><th colspan="6" align="center">Sequence Length</th> </tr> <tr> <th align="center">256</th><th align="center">512</th><th align="center">1024</th><th align="center">2048</th><th align="center">4096</th><th align="center">8192</th> </tr> <tr> <th rowspan="4">1.8B</th><td>LoRA</td> <td>1</td><td>1</td> <td align="center">6.7G / 1.0s/it</td><td align="center">7.4G / 1.0s/it</td><td align="center">8.4G / 1.1s/it</td><td align="center">11.0G / 1.7s/it</td><td align="center">16.2G / 3.3s/it</td><td align="center">21.8G / 6.8s/it</td> </tr> <tr> <td>LoRA (emb)</td> <td>1</td><td>1</td> <td align="center">13.7G / 1.0s/it</td><td align="center">14.0G / 1.0s/it</td><td align="center">14.0G / 1.1s/it</td><td align="center">15.1G / 1.8s/it</td><td align="center">19.7G / 3.4s/it</td><td align="center">27.7G / 7.0s/it</td> </tr> <tr> <td>Q-LoRA</td> <td>1</td><td>1</td> <td align="center">5.8G / 1.4s/it</td><td align="center">6.0G / 1.4s/it</td><td align="center">6.6G / 1.4s/it</td><td align="center">7.8G / 2.0s/it</td><td align="center">10.2G / 3.4s/it</td><td align="center">15.8G / 6.5s/it</td> </tr> <tr> <td>Full-parameter</td> <td>1</td><td>1</td> <td align="center">43.5G / 2.1s/it</td><td align="center">43.5G / 2.2s/it</td><td align="center">43.5G / 2.2s/it</td><td align="center">43.5G / 2.3s/it</td><td align="center">47.1G / 2.8s/it</td><td align="center">48.3G / 5.6s/it</td> </tr> <tr> <th rowspan="5">7B</th> <td>LoRA</td> <td>1</td><td>1</td> <td align="center">20.1G / 1.2s/it</td><td align="center">20.4G / 1.5s/it</td><td align="center">21.5G / 2.8s/it</td><td align="center">23.8G / 5.2s/it</td><td align="center">29.7G / 10.1s/it</td><td align="center">36.6G / 21.3s/it</td> </tr> <tr> <td>LoRA (emb)</td> <td>1</td><td>1</td> <td align="center">33.7G / 1.4s/it</td><td align="center">34.1G / 1.6s/it</td><td align="center">35.2G / 2.9s/it</td><td align="center">35.1G / 5.3s/it</td><td align="center">39.2G / 10.3s/it</td><td align="center">48.5G / 21.7s/it</td> </tr> <tr> <td>Q-LoRA</td> <td>1</td><td>1</td> <td align="center">11.5G / 3.0s/it</td><td align="center">11.5G / 3.0s/it</td><td align="center">12.3G / 3.5s/it</td><td align="center">13.9G / 7.0s/it</td><td align="center">16.9G / 11.6s/it</td><td align="center">23.5G / 22.3s/it</td> </tr> <tr> <td>Full-parameter</td> <td>1</td><td>2</td> <td align="center">139.2G / 4.0s/it</td><td align="center">148.0G / 4.0s/it</td><td align="center">162.0G / 4.5s/it</td><td align="center">-</td><td align="center">-</td><td align="center">-</td> </tr> <tr> <td>LoRA (multinode)</td> <td>2</td><td>2</td> <td align="center">74.7G / 2.09s/it</td><td align="center">77.6G / 3.16s/it</td><td align="center">84.9G / 5.17s/it</td><td align="center">95.1G / 9.25s/it</td><td align="center">121.1G / 18.1s/it</td><td align="center">155.5G / 37.4s/it</td> </tr> <tr> <th rowspan="3">14B</th> <td>LoRA</td> <td>1</td><td>1</td> <td align="center">34.6G / 1.6s/it</td><td align="center">35.1G / 2.4s/it</td><td align="center">35.3G / 4.4s/it</td><td align="center">37.4G / 8.4s/it</td><td align="center">42.5G / 17.0s/it</td><td align="center">55.2G / 36.0s/it</td> </tr> <tr> <td>LoRA (emb)</td> <td>1</td><td>1</td> <td align="center">51.2 / 1.7s/it</td><td align="center">51.1G / 2.6s/it</td><td align="center">51.5G / 4.6s/it</td><td align="center">54.1G / 8.6s/it</td><td align="center">56.8G / 17.2s/it</td><td align="center">67.7G / 36.3s/it</td> </tr> <tr> <td>Q-LoRA</td> <td>1</td><td>1</td> <td align="center">18.7G / 5.3s/it</td><td align="center">18.4G / 6.3s/it</td><td align="center">18.9G / 8.2s/it</td><td align="center">19.9G / 11.8s/it</td><td align="center">23.0G / 20.1s/it</td><td align="center">27.9G / 38.3s/it</td> </tr> <tr> <th rowspan="2">72B</th> <td>LoRA + Deepspeed Zero3</td> <td>1</td><td>4</td> <td align="center">215.4G / 17.6s/it</td><td align="center">217.7G / 20.5s/it</td><td align="center">222.6G / 29.4s/it</td><td align="center">228.8G / 45.7s/it</td><td align="center">249.0G / 83.4s/it</td><td align="center">289.2G / 161.5s/it</td> </tr> <tr> <td>Q-LoRA</td> <td>1</td><td>1</td> <td align="center">61.4G / 27.4s/it</td><td align="center">61.4G / 31.5s/it</td><td align="center">62.9G / 41.4s/it</td><td align="center">64.1G / 59.5s/it</td><td align="center">68.0G / 97.7s/it</td><td align="center">75.6G / 179.8s/it</td> </tr> </tbody></table></markdown-accessiblity-table> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Deployment</h2><a id="user-content-deployment" class="anchor" aria-label="Permalink: Deployment" href="#deployment"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">vLLM</h3><a id="user-content-vllm" class="anchor" aria-label="Permalink: vLLM" href="#vllm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">For deployment and fast inference, we suggest using vLLM.</p> <p dir="auto">If you use <strong>CUDA 12.1 and PyTorch 2.1</strong>, you can directly use the following command to install vLLM.</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install vllm"><pre>pip install vllm</pre></div> <p dir="auto">Otherwise, please refer to the official vLLM <a href="https://docs.vllm.ai/en/latest/getting_started/installation.html" rel="nofollow">Installation Instructions</a>.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">vLLM + Transformer-like Wrapper</h4><a id="user-content-vllm--transformer-like-wrapper" class="anchor" aria-label="Permalink: vLLM + Transformer-like Wrapper" href="#vllm--transformer-like-wrapper"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">You can download the <a href="/QwenLM/Qwen/blob/main/examples/vllm_wrapper.py">wrapper codes</a> and execute the following commands for multiple rounds of dialogue interaction. (Note: It currently only supports the <code>model.chat()</code> method.)</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from vllm_wrapper import vLLMWrapper model = vLLMWrapper('Qwen/Qwen-7B-Chat', tensor_parallel_size=1) # model = vLLMWrapper('Qwen/Qwen-7B-Chat-Int4', tensor_parallel_size=1, dtype="float16") response, history = model.chat(query="你好", history=None) print(response) response, history = model.chat(query="给我讲一个年轻人奋斗创业最终取得成功的故事。", history=history) print(response) response, history = model.chat(query="给这个故事起一个标题", history=history) print(response)"><pre><span class="pl-k">from</span> <span class="pl-s1">vllm_wrapper</span> <span class="pl-k">import</span> <span class="pl-s1">vLLMWrapper</span> <span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-en">vLLMWrapper</span>(<span class="pl-s">'Qwen/Qwen-7B-Chat'</span>, <span class="pl-s1">tensor_parallel_size</span><span class="pl-c1">=</span><span class="pl-c1">1</span>) <span class="pl-c"># model = vLLMWrapper('Qwen/Qwen-7B-Chat-Int4', tensor_parallel_size=1, dtype="float16")</span> <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">query</span><span class="pl-c1">=</span><span class="pl-s">"你好"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-c1">None</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">query</span><span class="pl-c1">=</span><span class="pl-s">"给我讲一个年轻人奋斗创业最终取得成功的故事。"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>) <span class="pl-s1">response</span>, <span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-c1">chat</span>(<span class="pl-s1">query</span><span class="pl-c1">=</span><span class="pl-s">"给这个故事起一个标题"</span>, <span class="pl-s1">history</span><span class="pl-c1">=</span><span class="pl-s1">history</span>) <span class="pl-en">print</span>(<span class="pl-s1">response</span>)</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">vLLM + Web Demo / OpenAI-like API</h4><a id="user-content-vllm--web-demo--openai-like-api" class="anchor" aria-label="Permalink: vLLM + Web Demo / OpenAI-like API" href="#vllm--web-demo--openai-like-api"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">You can use FastChat to lauch a web demo or an OpenAI API server. First, install FastChat:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install "fschat[model_worker,webui]""><pre>pip install <span class="pl-s"><span class="pl-pds">"</span>fschat[model_worker,webui]<span class="pl-pds">"</span></span></pre></div> <p dir="auto">To run Qwen with vLLM and FastChat, you need launch a controller by:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -m fastchat.serve.controller"><pre>python -m fastchat.serve.controller</pre></div> <p dir="auto">Then you can launch the model worker, which means loading your model for inference. For single GPU inference, you can directly run:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype bfloat16 # python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype float16 # run int4 model"><pre>python -m fastchat.serve.vllm_worker --model-path <span class="pl-smi">$model_path</span> --trust-remote-code --dtype bfloat16 <span class="pl-c"><span class="pl-c">#</span> python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --dtype float16 # run int4 model</span></pre></div> <p dir="auto">However, if you hope to run the model on multiple GPUs for faster inference or larger memory, you can use tensor parallelism supported by vLLM. Suppose you run the model on 4 GPUs, the command is shown below:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype bfloat16 # python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype float16 # run int4 model"><pre>python -m fastchat.serve.vllm_worker --model-path <span class="pl-smi">$model_path</span> --trust-remote-code --tensor-parallel-size 4 --dtype bfloat16 <span class="pl-c"><span class="pl-c">#</span> python -m fastchat.serve.vllm_worker --model-path $model_path --trust-remote-code --tensor-parallel-size 4 --dtype float16 # run int4 model</span></pre></div> <p dir="auto">After launching your model worker, you can launch a:</p> <ul dir="auto"> <li>Web UI Demo</li> </ul> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -m fastchat.serve.gradio_web_server"><pre>python -m fastchat.serve.gradio_web_server</pre></div> <ul dir="auto"> <li>OpenAI API</li> </ul> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -m fastchat.serve.openai_api_server --host localhost --port 8000"><pre>python -m fastchat.serve.openai_api_server --host localhost --port 8000</pre></div> <p dir="auto">However, if you find it difficult to use vLLM and FastChat, you can try our provided simplest methods to deploy a web demo, CLI demo, and API.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Web UI</h3><a id="user-content-web-ui" class="anchor" aria-label="Permalink: Web UI" href="#web-ui"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We provide code for users to build a web UI demo (thanks to @wysaid). Before you start, make sure you install the following packages:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pip install -r requirements_web_demo.txt"><pre class="notranslate"><code>pip install -r requirements_web_demo.txt </code></pre></div> <p dir="auto">Then run the command below and click on the generated link:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python web_demo.py"><pre>python web_demo.py</pre></div> <p align="center" dir="auto"> <br> <a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/web_demo.gif"><img src="/QwenLM/Qwen/raw/main/assets/web_demo.gif" width="600" data-animated-image="" style="max-width: 100%;"></a> <br> </p><p dir="auto"> </p><div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">CLI Demo</h3><a id="user-content-cli-demo" class="anchor" aria-label="Permalink: CLI Demo" href="#cli-demo"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We provide a CLI demo example in <code>cli_demo.py</code>, which supports streaming output for the generation. Users can interact with Qwen-7B-Chat by inputting prompts, and the model returns model outputs in the streaming mode. Run the command below:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python cli_demo.py"><pre>python cli_demo.py</pre></div> <p align="center" dir="auto"> <br> <a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/cli_demo.gif"><img src="/QwenLM/Qwen/raw/main/assets/cli_demo.gif" width="600" data-animated-image="" style="max-width: 100%;"></a> <br> </p><p dir="auto"> <br> </p><div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">API</h3><a id="user-content-api" class="anchor" aria-label="Permalink: API" href="#api"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We provide methods to deploy local API based on OpenAI API (thanks to @hanpenggit). Before you start, install the required packages:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pip install fastapi uvicorn "openai<1.0" pydantic sse_starlette"><pre>pip install fastapi uvicorn <span class="pl-s"><span class="pl-pds">"</span>openai<1.0<span class="pl-pds">"</span></span> pydantic sse_starlette</pre></div> <p dir="auto">Then run the command to deploy your API:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python openai_api.py"><pre>python openai_api.py</pre></div> <p dir="auto">You can change your arguments, e.g., <code>-c</code> for checkpoint name or path, <code>--cpu-only</code> for CPU deployment, etc. If you meet problems launching your API deployment, updating the packages to the latest version can probably solve them.</p> <p dir="auto">Using the API is also simple. See the example below:</p> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import openai openai.api_base = "http://localhost:8000/v1" openai.api_key = "none" # create a request activating streaming response for chunk in openai.ChatCompletion.create( model="Qwen", messages=[ {"role": "user", "content": "你好"} ], stream=True # Specifying stop words in streaming output format is not yet supported and is under development. ): if hasattr(chunk.choices[0].delta, "content"): print(chunk.choices[0].delta.content, end="", flush=True) # create a request not activating streaming response response = openai.ChatCompletion.create( model="Qwen", messages=[ {"role": "user", "content": "你好"} ], stream=False, stop=[] # You can add custom stop words here, e.g., stop=["Observation:"] for ReAct prompting. ) print(response.choices[0].message.content)"><pre><span class="pl-k">import</span> <span class="pl-s1">openai</span> <span class="pl-s1">openai</span>.<span class="pl-c1">api_base</span> <span class="pl-c1">=</span> <span class="pl-s">"http://localhost:8000/v1"</span> <span class="pl-s1">openai</span>.<span class="pl-c1">api_key</span> <span class="pl-c1">=</span> <span class="pl-s">"none"</span> <span class="pl-c"># create a request activating streaming response</span> <span class="pl-k">for</span> <span class="pl-s1">chunk</span> <span class="pl-c1">in</span> <span class="pl-s1">openai</span>.<span class="pl-c1">ChatCompletion</span>.<span class="pl-c1">create</span>( <span class="pl-s1">model</span><span class="pl-c1">=</span><span class="pl-s">"Qwen"</span>, <span class="pl-s1">messages</span><span class="pl-c1">=</span>[ {<span class="pl-s">"role"</span>: <span class="pl-s">"user"</span>, <span class="pl-s">"content"</span>: <span class="pl-s">"你好"</span>} ], <span class="pl-s1">stream</span><span class="pl-c1">=</span><span class="pl-c1">True</span> <span class="pl-c"># Specifying stop words in streaming output format is not yet supported and is under development.</span> ): <span class="pl-k">if</span> <span class="pl-en">hasattr</span>(<span class="pl-s1">chunk</span>.<span class="pl-c1">choices</span>[<span class="pl-c1">0</span>].<span class="pl-c1">delta</span>, <span class="pl-s">"content"</span>): <span class="pl-en">print</span>(<span class="pl-s1">chunk</span>.<span class="pl-c1">choices</span>[<span class="pl-c1">0</span>].<span class="pl-c1">delta</span>.<span class="pl-c1">content</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">""</span>, <span class="pl-s1">flush</span><span class="pl-c1">=</span><span class="pl-c1">True</span>) <span class="pl-c"># create a request not activating streaming response</span> <span class="pl-s1">response</span> <span class="pl-c1">=</span> <span class="pl-s1">openai</span>.<span class="pl-c1">ChatCompletion</span>.<span class="pl-c1">create</span>( <span class="pl-s1">model</span><span class="pl-c1">=</span><span class="pl-s">"Qwen"</span>, <span class="pl-s1">messages</span><span class="pl-c1">=</span>[ {<span class="pl-s">"role"</span>: <span class="pl-s">"user"</span>, <span class="pl-s">"content"</span>: <span class="pl-s">"你好"</span>} ], <span class="pl-s1">stream</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">stop</span><span class="pl-c1">=</span>[] <span class="pl-c"># You can add custom stop words here, e.g., stop=["Observation:"] for ReAct prompting.</span> ) <span class="pl-en">print</span>(<span class="pl-s1">response</span>.<span class="pl-c1">choices</span>[<span class="pl-c1">0</span>].<span class="pl-c1">message</span>.<span class="pl-c1">content</span>)</pre></div> <p align="center" dir="auto"> <br> <a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/openai_api.gif"><img src="/QwenLM/Qwen/raw/main/assets/openai_api.gif" width="600" data-animated-image="" style="max-width: 100%;"></a> <br> </p><p dir="auto"> </p><p dir="auto"><strong>Function calling</strong> is also supported (but only when <code>stream=False</code> for the moment). See the <a href="/QwenLM/Qwen/blob/main/examples/function_call_examples.py">example usage</a> here. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">🐳 Docker</h2><a id="user-content--docker" class="anchor" aria-label="Permalink: 🐳 Docker" href="#-docker"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">To simplify the deployment process, we provide docker images with pre-built environments: <a href="https://hub.docker.com/r/qwenllm/qwen" rel="nofollow">qwenllm/qwen</a>. You only need to install the driver and download model files to launch demos, deploy OpenAI API, and finetune the model.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Preparation</h3><a id="user-content-preparation" class="anchor" aria-label="Permalink: Preparation" href="#preparation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Install the correct version of Nvidia driver depending on the image to use:</li> </ol> <ul dir="auto"> <li><code>qwenllm/qwen:cu117</code> (<strong>recommend</strong>): <code>>= 515.48.07</code></li> <li><code>qwenllm/qwen:cu114</code> (w/o flash-attention): <code>>= 470.82.01</code></li> <li><code>qwenllm/qwen:cu121</code>: <code>>= 530.30.02</code></li> <li><code>qwenllm/qwen:latest</code>: same as <code>qwenllm/qwen:cu117</code></li> </ul> <ol start="2" dir="auto"> <li>Install and configure <a href="https://docs.docker.com/engine/install/" rel="nofollow">docker</a> and <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html" rel="nofollow">nvidia-container-toolkit</a>:</li> </ol> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# configure docker sudo systemctl start docker # test if docker is correctly installed sudo docker run hello-world # configure nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker # test if nvidia-container-toolkit is correctly installed sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi"><pre><span class="pl-c"><span class="pl-c">#</span> configure docker</span> sudo systemctl start docker <span class="pl-c"><span class="pl-c">#</span> test if docker is correctly installed</span> sudo docker run hello-world <span class="pl-c"><span class="pl-c">#</span> configure nvidia-container-toolkit</span> sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker <span class="pl-c"><span class="pl-c">#</span> test if nvidia-container-toolkit is correctly installed</span> sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi</pre></div> <ol start="3" dir="auto"> <li>Download model checkpoints and codes to your environment (see <a href="#DownloadModel">here</a>).</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Deployment</h3><a id="user-content-deployment-1" class="anchor" aria-label="Permalink: Deployment" href="#deployment-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Here we use Qwen-7B-Chat as an example. Before launching a web demo or API, you can setup the configuration as shown below:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="IMAGE_NAME=qwenllm/qwen:cu117 PORT=8901 CHECKPOINT_PATH=/path/to/Qwen-7B-Chat # Path to downloaded model checkpoints and codes"><pre>IMAGE_NAME=qwenllm/qwen:cu117 PORT=8901 CHECKPOINT_PATH=/path/to/Qwen-7B-Chat <span class="pl-c"><span class="pl-c">#</span> Path to downloaded model checkpoints and codes</span></pre></div> <p dir="auto">The following scripts can help you build:</p> <ul dir="auto"> <li>OpenAI API</li> </ul> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bash docker/docker_openai_api.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH} --port ${PORT}"><pre>bash docker/docker_openai_api.sh -i <span class="pl-smi">${IMAGE_NAME}</span> -c <span class="pl-smi">${CHECKPOINT_PATH}</span> --port <span class="pl-smi">${PORT}</span></pre></div> <ul dir="auto"> <li>Web UI</li> </ul> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bash docker/docker_web_demo.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH} --port ${PORT}"><pre>bash docker/docker_web_demo.sh -i <span class="pl-smi">${IMAGE_NAME}</span> -c <span class="pl-smi">${CHECKPOINT_PATH}</span> --port <span class="pl-smi">${PORT}</span></pre></div> <ul dir="auto"> <li>CLI Demo</li> </ul> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bash docker/docker_cli_demo.sh -i ${IMAGE_NAME} -c ${CHECKPOINT_PATH}"><pre>bash docker/docker_cli_demo.sh -i <span class="pl-smi">${IMAGE_NAME}</span> -c <span class="pl-smi">${CHECKPOINT_PATH}</span></pre></div> <p dir="auto">The commands above will automatically download the required image and launch a Web UI demo in background (the service will auto-restart). You can open <code>http://localhost:${PORT}</code> on the host to use the demo.</p> <p dir="auto">The demo is successfully launched if you see the following output:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Successfully started web demo. Open '...' to try! Run `docker logs ...` to check demo status. Run `docker rm -f ...` to stop and remove the demo."><pre lang="text" class="notranslate"><code>Successfully started web demo. Open '...' to try! Run `docker logs ...` to check demo status. Run `docker rm -f ...` to stop and remove the demo. </code></pre></div> <p dir="auto">If you want to check the status of the demo, you can use <code>docker logs qwen</code> to display outputs.</p> <p dir="auto">You can use <code>docker rm -f qwen</code> to stop the service and remove the container.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Finetuning</h3><a id="user-content-finetuning-1" class="anchor" aria-label="Permalink: Finetuning" href="#finetuning-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The method of finetuning using the pre-built Docker image is basically the same as <a href="#Finetuning">the above chapter</a> (we have already installed dependencies in the image):</p> <p dir="auto">The following is an example of single-GPU LoRA:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="IMAGE_NAME=qwenllm/qwen:cu117 CHECKPOINT_PATH=/path/to/Qwen-7B # Path to downloaded model checkpoints and codes #CHECKPOINT_PATH=/path/to/Qwen-7B-Chat-Int4 # Path to downloaded model checkpoints and codes (Q-LoRA) DATA_PATH=/path/to/data/root # Prepare finetune data at ${DATA_PATH}/example.json OUTPUT_PATH=/path/to/output/checkpoint # Path to finetune outputs # Use all host devices by default DEVICE=all # If you need to specify GPUs for training, set device as follow (NOTE: internal quotation marks cannot be omitted) #DEVICE='"device=0,1,2,3"' mkdir -p ${OUTPUT_PATH} # Single-GPU LoRA finetuning docker run --gpus ${DEVICE} --rm --name qwen \ --mount type=bind,source=${CHECKPOINT_PATH},target=/data/shared/Qwen/Qwen-7B \ --mount type=bind,source=${DATA_PATH},target=/data/shared/Qwen/data \ --mount type=bind,source=${OUTPUT_PATH},target=/data/shared/Qwen/output_qwen \ --shm-size=2gb \ -it ${IMAGE_NAME} \ bash finetune/finetune_lora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B/ -d /data/shared/Qwen/data/example.json"><pre>IMAGE_NAME=qwenllm/qwen:cu117 CHECKPOINT_PATH=/path/to/Qwen-7B <span class="pl-c"><span class="pl-c">#</span> Path to downloaded model checkpoints and codes</span> <span class="pl-c"><span class="pl-c">#</span>CHECKPOINT_PATH=/path/to/Qwen-7B-Chat-Int4 # Path to downloaded model checkpoints and codes (Q-LoRA)</span> DATA_PATH=/path/to/data/root <span class="pl-c"><span class="pl-c">#</span> Prepare finetune data at ${DATA_PATH}/example.json</span> OUTPUT_PATH=/path/to/output/checkpoint <span class="pl-c"><span class="pl-c">#</span> Path to finetune outputs</span> <span class="pl-c"><span class="pl-c">#</span> Use all host devices by default</span> DEVICE=all <span class="pl-c"><span class="pl-c">#</span> If you need to specify GPUs for training, set device as follow (NOTE: internal quotation marks cannot be omitted)</span> <span class="pl-c"><span class="pl-c">#</span>DEVICE='"device=0,1,2,3"'</span> mkdir -p <span class="pl-smi">${OUTPUT_PATH}</span> <span class="pl-c"><span class="pl-c">#</span> Single-GPU LoRA finetuning</span> docker run --gpus <span class="pl-smi">${DEVICE}</span> --rm --name qwen \ --mount type=bind,source=<span class="pl-smi">${CHECKPOINT_PATH}</span>,target=/data/shared/Qwen/Qwen-7B \ --mount type=bind,source=<span class="pl-smi">${DATA_PATH}</span>,target=/data/shared/Qwen/data \ --mount type=bind,source=<span class="pl-smi">${OUTPUT_PATH}</span>,target=/data/shared/Qwen/output_qwen \ --shm-size=2gb \ -it <span class="pl-smi">${IMAGE_NAME}</span> \ bash finetune/finetune_lora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B/ -d /data/shared/Qwen/data/example.json</pre></div> <p dir="auto">To make a change to single-GPU Q-LoRA for example, you just need to modify the bash command inside <code>docker run</code>:</p> <div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bash finetune/finetune_qlora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B-Chat-Int4/ -d /data/shared/Qwen/data/example.json"><pre>bash finetune/finetune_qlora_single_gpu.sh -m /data/shared/Qwen/Qwen-7B-Chat-Int4/ -d /data/shared/Qwen/data/example.json</pre></div> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">🔥 System Prompt</h2><a id="user-content--system-prompt" class="anchor" aria-label="Permalink: 🔥 System Prompt" href="#-system-prompt"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Qwen-1.8-Chat and Qwen-72B-Chat have been fully trained on diverse system prompts with multiple rounds of complex interactions, so that they can follow a variety of system prompts and realize model customization in context, further improving the scalability of Qwen-chat.</p> <p dir="auto">With System Prompt, Qwen-Chat can realize <strong>roly playing</strong>, <strong>language style transfer</strong>, <strong>task setting</strong>, and <strong>behavior setting</strong>.</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/system_prompt_language_style.png"><img src="/QwenLM/Qwen/raw/main/assets/system_prompt_language_style.png" alt="" style="max-width: 100%;"></a></p> <p dir="auto"><a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/system_prompt_role_play_en.png"><img src="/QwenLM/Qwen/raw/main/assets/system_prompt_role_play_en.png" alt="" style="max-width: 100%;"></a></p> <p dir="auto">For more information, please refer to the <a href="/QwenLM/Qwen/blob/main/examples/system_prompt.md">example documentation</a>.</p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Tool Usage</h2><a id="user-content-tool-usage" class="anchor" aria-label="Permalink: Tool Usage" href="#tool-usage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Qwen-Chat has been optimized for tool usage and function calling capabilities. Users can develop agents, LangChain applications, and even augment Qwen with a Python Code Interpreter.</p> <p dir="auto">We provide documentation on how to implement tool calls based on the principle of ReAct Prompting, please refer to <a href="/QwenLM/Qwen/blob/main/examples/react_prompt.md">the ReAct example</a>. Based on this principle, we provide support for function calling in <a href="/QwenLM/Qwen/blob/main/openai_api.py">openai_api.py</a>.</p> <p dir="auto">We have tested the model's tool calling capabilities on our open-source Chinese evaluation benchmark and found that Qwen-Chat consistently performs well:</p> <markdown-accessiblity-table><table> <tbody><tr> <th colspan="4" align="center">Chinese Tool-Use Benchmark (Version 20231206)</th> </tr> <tr> <th align="center">Model</th><th align="center">Tool Selection (Acc.↑)</th><th align="center">Tool Input (Rouge-L↑)</th><th align="center">False Positive Error↓</th> </tr> <tr> <td>GPT-4</td><td align="center">98.0%</td><td align="center">0.953</td><td align="center">23.9%</td> </tr> <tr> <td>GPT-3.5</td><td align="center">74.5%</td><td align="center">0.807</td><td align="center">80.6%</td> </tr> <tr> <td>Qwen-1_8B-Chat</td><td align="center">85.0%</td><td align="center">0.839</td><td align="center">27.6%</td> </tr> <tr> <td>Qwen-7B-Chat</td><td align="center">95.5%</td><td align="center">0.900</td><td align="center">11.6%</td> </tr> <tr> <td>Qwen-14B-Chat</td><td align="center">96.9%</td><td align="center">0.917</td><td align="center">5.6%</td> </tr> <tr> <td>Qwen-72B-Chat</td><td align="center">98.2%</td><td align="center">0.927</td><td align="center">1.1%</td> </tr> </tbody></table></markdown-accessiblity-table> <p dir="auto">To assess Qwen's ability to use the Python Code Interpreter for tasks such as mathematical problem solving, data visualization, and other general-purpose tasks such as file handling and web scraping, we have created and open-sourced a benchmark specifically designed for evaluating these capabilities. You can find the benchmark at this <a href="https://github.com/QwenLM/Qwen-Agent/tree/main/benchmark">link</a>.</p> <p dir="auto">We have observed that Qwen performs well in terms of code executability and result accuracy when generating code:</p> <markdown-accessiblity-table><table> <tbody><tr> <th colspan="5" align="center">Code Interpreter Benchmark (Version 20231206)</th> </tr> <tr> <th rowspan="2" align="center">Model</th> <th colspan="3" align="center">Accuracy of Code Execution Results (%)</th> <th colspan="1" align="center">Executable Rate of Code (%)</th> </tr> <tr> <th align="center">Math↑</th><th align="center">Visualization-Hard↑</th><th align="center">Visualization-Easy↑</th><th align="center">General↑</th> </tr> <tr> <td>GPT-4</td> <td align="center">82.8</td> <td align="center">66.7</td> <td align="center">60.8</td> <td align="center">82.8</td> </tr> <tr> <td>GPT-3.5</td> <td align="center">47.3</td> <td align="center">33.3</td> <td align="center">55.7</td> <td align="center">74.1</td> </tr> <tr> <td>LLaMA2-13B-Chat</td> <td align="center">8.3</td> <td align="center">1.2</td> <td align="center">15.2</td> <td align="center">48.3</td> </tr> <tr> <td>CodeLLaMA-13B-Instruct</td> <td align="center">28.2</td> <td align="center">15.5</td> <td align="center">21.5</td> <td align="center">74.1</td> </tr> <tr> <td>InternLM-20B-Chat</td> <td align="center">34.6</td> <td align="center">10.7</td> <td align="center">25.1</td> <td align="center">65.5</td> </tr> <tr> <td>ChatGLM3-6B</td> <td align="center">54.2</td> <td align="center">4.8</td> <td align="center">15.2</td> <td align="center">67.1</td> </tr> <tr> <td>Qwen-1.8B-Chat</td> <td align="center">25.6</td> <td align="center">21.4</td> <td align="center">22.8</td> <td align="center">65.5</td> </tr> <tr> <td>Qwen-7B-Chat</td> <td align="center">41.9</td> <td align="center">23.8</td> <td align="center">38.0</td> <td align="center">67.2</td> </tr> <tr> <td>Qwen-14B-Chat</td> <td align="center">58.4</td> <td align="center">31.0</td> <td align="center">45.6</td> <td align="center">65.5</td> </tr> <tr> <td>Qwen-72B-Chat</td> <td align="center">72.7</td> <td align="center">41.7</td> <td align="center">43.0</td> <td align="center">82.8</td> </tr> </tbody></table></markdown-accessiblity-table> <p align="center" dir="auto"> <br> <a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/code_interpreter_showcase_001.jpg"><img src="/QwenLM/Qwen/raw/main/assets/code_interpreter_showcase_001.jpg" style="max-width: 100%;"></a> <br> </p><p dir="auto"> <br> </p><div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Long-Context Understanding</h2><a id="user-content-long-context-understanding" class="anchor" aria-label="Permalink: Long-Context Understanding" href="#long-context-understanding"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">To extend the context length and break the bottleneck of training sequence length, we introduce several techniques, including NTK-aware interpolation, window attention, and LogN attention scaling, to extend the context length of Qwen-14B from 2K to over 8K tokens, and Qwen-1.8B/7B from 8K to 32K tokens.</p> <p dir="auto">For Qwen-72B, we adapt RoPE to longer contexts with a larger rotary base. Qwen-72B supports the max context length of 32K tokens.</p> <p dir="auto">We conduct language modeling experiments on the arXiv dataset with the PPL evaluation and find that Qwen can reach outstanding performance in the scenario of long context. Results are demonstrated below:</p> <markdown-accessiblity-table><table> <tbody><tr> <th rowspan="2">Model</th><th colspan="6" align="center">Sequence Length</th> </tr> <tr> <th align="center">1024</th><th align="center">2048</th><th align="center">4096</th><th align="center">8192</th><th align="center">16384</th><th align="center">32768</th> </tr> <tr> <td>Qwen-7B (original)</td><td align="center">4.23</td><td align="center">3.78</td><td align="center">39.35</td><td align="center">469.81</td><td align="center">2645.09</td><td align="center">-</td> </tr> <tr> <td>+ dynamic_ntk</td><td align="center">4.23</td><td align="center">3.78</td><td align="center">3.59</td><td align="center">3.66</td><td align="center">5.71</td><td align="center">-</td> </tr> <tr> <td>+ dynamic_ntk + logn</td><td align="center">4.23</td><td align="center">3.78</td><td align="center">3.58</td><td align="center">3.56</td><td align="center">4.62</td><td align="center">-</td> </tr> <tr> <td>+ dynamic_ntk + logn + window_attn</td><td align="center">4.23</td><td align="center">3.78</td><td align="center">3.58</td><td align="center">3.49</td><td align="center">4.32</td><td align="center">-</td> </tr> <tr> </tr><tr> <td>Qwen-1.8B</td><td align="center"><b>5.00</b></td><td align="center"><b>4.48</b></td><td align="center"><b>4.13</b></td><td align="center"><b>3.89</b></td><td align="center">17.42</td><td align="center">433.85</td> </tr> <tr> <td>+ dynamic_ntk + logn + window_attn</td><td align="center"><b>5.00</b></td><td align="center"><b>4.48</b></td><td align="center"><b>4.14</b></td><td align="center"><b>3.93</b></td><td align="center"><b>3.82</b></td><td align="center"><b>3.83</b></td> </tr> <tr> <td>Qwen-7B</td><td align="center"><b>4.23</b></td><td align="center"><b>3.81</b></td><td align="center"><b>3.52</b></td><td align="center"><b>3.31</b></td><td align="center">7.27</td><td align="center">181.49</td> </tr> <tr> <td>+ dynamic_ntk + logn + window_attn</td><td align="center"><b>4.23</b></td><td align="center"><b>3.81</b></td><td align="center"><b>3.52</b></td><td align="center"><b>3.33</b></td><td align="center"><b>3.22</b></td><td align="center"><b>3.17</b></td> </tr> <tr> <td>Qwen-14B</td><td align="center"><b>-</b></td><td align="center"><b>3.46</b></td><td align="center">22.79</td><td align="center">334.65</td><td align="center">3168.35</td><td align="center">-</td> </tr> <tr> <td>+ dynamic_ntk + logn + window_attn</td><td align="center"><b>-</b></td><td align="center"><b>3.46</b></td><td align="center"><b>3.29</b></td><td align="center"><b>3.18</b></td><td align="center">3.42</td><td align="center">-</td> </tr> <tr> <td>Qwen-72B</td><td align="center"><b>-</b></td><td align="center"><b>-</b></td><td align="center">-</td><td align="center"><b>2.83</b></td><td align="center"><b>2.73</b></td><td align="center"><b>2.72</b></td> </tr> </tbody></table></markdown-accessiblity-table> <p dir="auto">Furthermore, to verify the ability of Qwen-72B-Chat on long text understanding, we tested it on <a href="https://arxiv.org/abs/2307.11088" rel="nofollow">L-Eval</a> (closed-ended tasks). The results are as follows:</p> <markdown-accessiblity-table><table> <thead> <tr> <th align="left">Model</th> <th align="center">Input Length</th> <th align="center">Average</th> <th align="center">Coursera</th> <th align="center">GSM</th> <th align="center">QuALITY</th> <th align="center">TOEFL</th> <th align="center">CodeU</th> <th align="center">SFcition</th> </tr> </thead> <tbody> <tr> <td align="left">ChatGPT-3.5-16k</td> <td align="center">16K</td> <td align="center">60.73</td> <td align="center"><strong>63.51</strong></td> <td align="center"><strong>84.00</strong></td> <td align="center">61.38</td> <td align="center">78.43</td> <td align="center"><strong>12.22</strong></td> <td align="center">64.84</td> </tr> <tr> <td align="left"><strong>Qwen-72B-Chat</strong></td> <td align="center">32K</td> <td align="center"><strong>62.30</strong></td> <td align="center">58.13</td> <td align="center">76.00</td> <td align="center"><strong>77.22</strong></td> <td align="center"><strong>86.24</strong></td> <td align="center">6.66</td> <td align="center"><strong>69.53</strong></td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">We conducted the "needle in a haystack" experiment (the idea came from <a href="https://twitter.com/GregKamradt/status/1727018183608193393" rel="nofollow">@Greg Kamradt</a>) to test whether the model can retrieve information at different positions in the inputs of different lengths, the result is as follows:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer" href="/QwenLM/Qwen/blob/main/assets/qwen_72b_needle_in_a_haystack.png"><img src="/QwenLM/Qwen/raw/main/assets/qwen_72b_needle_in_a_haystack.png" alt="" style="max-width: 100%;"></a></p> <p dir="auto">The above results show that Qwen-72B-Chat can accurately retrieve information placed in various positions within an input length of 32k, proving its excellent long text understanding capabilities.</p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Tokenizer</h2><a id="user-content-tokenizer" class="anchor" aria-label="Permalink: Tokenizer" href="#tokenizer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Our tokenizer based on tiktoken is different from other tokenizers, e.g., sentencepiece tokenizer. You need to pay attention to special tokens, especially in finetuning. For more detailed information on the tokenizer and related use in fine-tuning, please refer to the <a href="/QwenLM/Qwen/blob/main/tokenization_note.md">documentation</a>. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Reproduction</h2><a id="user-content-reproduction" class="anchor" aria-label="Permalink: Reproduction" href="#reproduction"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">For your reproduction of the model performance on benchmark datasets, we provide scripts for you to reproduce the results. Check <a href="/QwenLM/Qwen/blob/main/eval/EVALUATION.md">eval/EVALUATION.md</a> for more information. Note that the reproduction may lead to slight differences from our reported results. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">FAQ</h2><a id="user-content-faq" class="anchor" aria-label="Permalink: FAQ" href="#faq"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">If you meet problems, please refer to <a href="/QwenLM/Qwen/blob/main/FAQ.md">FAQ</a> and the issues first to search a solution before you launch a new issue. <br><br></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Citation</h2><a id="user-content-citation" class="anchor" aria-label="Permalink: Citation" href="#citation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">If you find our work helpful, feel free to give us a cite.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@article{qwen, title={Qwen Technical Report}, author={Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu}, journal={arXiv preprint arXiv:2309.16609}, year={2023} }"><pre class="notranslate"><code>@article{qwen, title={Qwen Technical Report}, author={Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu}, journal={arXiv preprint arXiv:2309.16609}, year={2023} } </code></pre></div> <br> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">License Agreement</h2><a id="user-content-license-agreement" class="anchor" aria-label="Permalink: License Agreement" href="#license-agreement"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The source code provided at <a href="https://github.com/QwenLM/Qwen">https://github.com/QwenLM/Qwen</a> is licensed under the <a href="/QwenLM/Qwen/blob/main/LICENSE">Apache 2.0 License</a> that can be found at the root directory.</p> <p dir="auto">Researchers and developers are free to use the codes and model weights of both Qwen and Qwen-Chat. For their commercial use, please check the License Agreement accompanying each model.</p> <ul dir="auto"> <li> <p dir="auto">Qwen-72B, Qwen-14B, and Qwen-7B are licensed under the <a href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT">Tongyi Qianwen LICENSE AGREEMENT</a> that can be found at the corresponding HuggingFace and ModelScope repository. For commercial use, please fill out the form (<a href="https://dashscope.console.aliyun.com/openModelApply/Qwen-72B-Chat" rel="nofollow">72B</a>, <a href="https://dashscope.console.aliyun.com/openModelApply/Qwen-14B-Chat" rel="nofollow">14B</a>, and <a href="https://dashscope.console.aliyun.com/openModelApply/qianwen" rel="nofollow">7B</a>) to apply.</p> </li> <li> <p dir="auto">Qwen-1.8B is licensed under the <a href="/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20RESEARCH%20LICENSE%20AGREEMENT">Tongyi Qianwen RESEARCH LICENSE AGREEMENT</a> that can be found at the corresponding HuggingFace and ModelScope repository. For commercial use, please contact us. <br><br></p> </li> </ul> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Contact Us</h2><a id="user-content-contact-us" class="anchor" aria-label="Permalink: Contact Us" href="#contact-us"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">If you are interested to leave a message to either our research team or product team, join our Discord or WeChat groups! Also, feel free to send an email to <a href="mailto:qianwen_opensource@alibabacloud.com">qianwen_opensource@alibabacloud.com</a>.</p> </article></div></div></div></div></div> <!-- --> <!-- --> <script type="application/json" id="__PRIMER_DATA_:R0:__">{"resolvedServerColorMode":"day"}</script></div> </react-partial> <input type="hidden" data-csrf="true" value="60PQ+fDiYFvpo1RHobKuOWCU7ry2lSCrDydmpX+QCWAGmnsnUkDv1bqMCG6UBVqrcFq512HCWqDMoy5q6ThtSg==" /> </div> <div data-view-component="true" class="Layout-sidebar"> <div class="BorderGrid about-margin" data-pjax> <div class="BorderGrid-row"> <div class="BorderGrid-cell"> <div class="hide-sm hide-md"> <h2 class="mb-3 h4">About</h2> <p class="f4 my-3"> The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. </p> <h3 class="sr-only">Topics</h3> <div class="my-3"> <div class="f6"> <a href="/topics/natural-language-processing" title="Topic: natural-language-processing" data-view-component="true" class="topic-tag topic-tag-link"> natural-language-processing </a> <a href="/topics/chinese" title="Topic: chinese" data-view-component="true" class="topic-tag topic-tag-link"> chinese </a> <a href="/topics/pretrained-models" title="Topic: pretrained-models" data-view-component="true" class="topic-tag topic-tag-link"> pretrained-models </a> <a href="/topics/large-language-models" title="Topic: large-language-models" data-view-component="true" class="topic-tag topic-tag-link"> large-language-models </a> <a href="/topics/llm" title="Topic: llm" data-view-component="true" class="topic-tag topic-tag-link"> llm </a> <a href="/topics/flash-attention" title="Topic: flash-attention" data-view-component="true" class="topic-tag topic-tag-link"> flash-attention </a> </div> </div> <h3 class="sr-only">Resources</h3> <div class="mt-2"> <a class="Link--muted" data-analytics-event="{"category":"Repository Overview","action":"click","label":"location:sidebar;file:readme"}" href="#readme-ov-file"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-book mr-2"> <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path> </svg> Readme </a> </div> <h3 class="sr-only">License</h3> <div class="mt-2"> <a href="#Apache-2.0-1-ov-file" class="Link--muted" data-analytics-event="{"category":"Repository Overview","action":"click","label":"location:sidebar;file:license"}" > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-law mr-2"> <path d="M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z"></path> </svg> Apache-2.0 license </a> </div> <include-fragment src="/QwenLM/Qwen/hovercards/citation/sidebar_partial?tree_name=main"> </include-fragment> <div class="mt-2"> <a href="/QwenLM/Qwen/activity" data-view-component="true" class="Link Link--muted"><svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-pulse mr-2"> <path d="M6 2c.306 0 .582.187.696.471L10 10.731l1.304-3.26A.751.751 0 0 1 12 7h3.25a.75.75 0 0 1 0 1.5h-2.742l-1.812 4.528a.751.751 0 0 1-1.392 0L6 4.77 4.696 8.03A.75.75 0 0 1 4 8.5H.75a.75.75 0 0 1 0-1.5h2.742l1.812-4.529A.751.751 0 0 1 6 2Z"></path> </svg> <span class="color-fg-muted">Activity</span></a> </div> <div class="mt-2"> <a href="/QwenLM/Qwen/custom-properties" data-view-component="true" class="Link Link--muted"><svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-note mr-2"> <path d="M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25Zm1.75-.25a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25ZM3.5 6.25a.75.75 0 0 1 .75-.75h7a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1-.75-.75Zm.75 2.25h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1 0-1.5Z"></path> </svg> <span class="color-fg-muted">Custom properties</span></a> </div> <h3 class="sr-only">Stars</h3> <div class="mt-2"> <a href="/QwenLM/Qwen/stargazers" data-view-component="true" class="Link Link--muted"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path> </svg> <strong>16.9k</strong> stars</a> </div> <h3 class="sr-only">Watchers</h3> <div class="mt-2"> <a href="/QwenLM/Qwen/watchers" data-view-component="true" class="Link Link--muted"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-eye mr-2"> <path d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"></path> </svg> <strong>128</strong> watching</a> </div> <h3 class="sr-only">Forks</h3> <div class="mt-2"> <a href="/QwenLM/Qwen/forks" data-view-component="true" class="Link Link--muted"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path> </svg> <strong>1.4k</strong> forks</a> </div> <div class="mt-2"> <a class="Link--muted" href="/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FQwenLM%2FQwen&report=QwenLM+%28user%29"> Report repository </a> </div> </div> </div> </div> <div class="BorderGrid-row"> <div class="BorderGrid-cell"> <h2 class="h4 mb-3" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame"> <a href="/QwenLM/Qwen/releases" data-view-component="true" class="Link--primary no-underline Link">Releases</a></h2> <div class="text-small color-fg-muted">No releases published</div> </div> </div> <div class="BorderGrid-row"> <div class="BorderGrid-cell"> <h2 class="h4 mb-3"> <a href="/orgs/QwenLM/packages?repo_name=Qwen" data-view-component="true" class="Link--primary no-underline Link d-flex flex-items-center">Packages <span title="0" hidden="hidden" data-view-component="true" class="Counter ml-1">0</span></a></h2> <div class="text-small color-fg-muted" > No packages published <br> </div> </div> </div> <div class="BorderGrid-row" hidden> <div class="BorderGrid-cell"> <include-fragment src="/QwenLM/Qwen/used_by_list" accept="text/fragment+html"> </include-fragment> </div> </div> <div class="BorderGrid-row"> <div class="BorderGrid-cell"> <h2 class="h4 mb-3"> <a href="/QwenLM/Qwen/graphs/contributors" data-view-component="true" class="Link--primary no-underline Link d-flex flex-items-center">Contributors <span title="30" data-view-component="true" class="Counter ml-1">30</span></a></h2> <ul class="list-style-none d-flex flex-wrap mb-n2"> <li class="mb-2 mr-2" > <a href="https://github.com/JustinLin610" class="" data-hovercard-type="user" data-hovercard-url="/users/JustinLin610/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/27664428?s=64&v=4" alt="@JustinLin610" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/yangapku" class="" data-hovercard-type="user" data-hovercard-url="/users/yangapku/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/17445544?s=64&v=4" alt="@yangapku" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/JianxinMa" class="" data-hovercard-type="user" data-hovercard-url="/users/JianxinMa/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/7543016?s=64&v=4" alt="@JianxinMa" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/jklj077" class="" data-hovercard-type="user" data-hovercard-url="/users/jklj077/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/17811943?s=64&v=4" alt="@jklj077" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/jxst539246" class="" data-hovercard-type="user" data-hovercard-url="/users/jxst539246/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/17763236?s=64&v=4" alt="@jxst539246" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/fyabc" class="" data-hovercard-type="user" data-hovercard-url="/users/fyabc/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/12120155?s=64&v=4" alt="@fyabc" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/logicwong" class="" data-hovercard-type="user" data-hovercard-url="/users/logicwong/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/36780733?s=64&v=4" alt="@logicwong" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/eltociear" class="" data-hovercard-type="user" data-hovercard-url="/users/eltociear/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/22633385?s=64&v=4" alt="@eltociear" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/hzhwcmhf" class="" data-hovercard-type="user" data-hovercard-url="/users/hzhwcmhf/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/1344510?s=64&v=4" alt="@hzhwcmhf" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/wysaid" class="" data-hovercard-type="user" data-hovercard-url="/users/wysaid/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/1430725?s=64&v=4" alt="@wysaid" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/huybery" class="" data-hovercard-type="user" data-hovercard-url="/users/huybery/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/13436140?s=64&v=4" alt="@huybery" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/simonJJJ" class="" data-hovercard-type="user" data-hovercard-url="/users/simonJJJ/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/32785733?s=64&v=4" alt="@simonJJJ" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/liudayiheng" class="" data-hovercard-type="user" data-hovercard-url="/users/liudayiheng/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/19410839?s=64&v=4" alt="@liudayiheng" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> <li class="mb-2 mr-2" > <a href="https://github.com/GanjinZero" class="" data-hovercard-type="user" data-hovercard-url="/users/GanjinZero/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" > <img src="https://avatars.githubusercontent.com/u/19466330?s=64&v=4" alt="@GanjinZero" size="32" height="32" width="32" data-view-component="true" class="avatar circle" /> </a> </li> </ul> <div data-view-component="true" class="mt-3"> <a text="small" href="/QwenLM/Qwen/graphs/contributors" data-view-component="true" class="Link--inTextBlock Link">+ 16 contributors</a></div> </div> </div> <div class="BorderGrid-row"> <div class="BorderGrid-cell"> <h2 class="h4 mb-3">Languages</h2> <div class="mb-2"> <span data-view-component="true" class="Progress"> <span style="background-color:#3572A5 !important;;width: 62.8%;" itemprop="keywords" data-view-component="true" class="Progress-item color-bg-success-emphasis"></span> <span style="background-color:#DA5B0B !important;;width: 30.8%;" itemprop="keywords" data-view-component="true" class="Progress-item color-bg-success-emphasis"></span> <span style="background-color:#89e051 !important;;width: 5.4%;" itemprop="keywords" data-view-component="true" class="Progress-item color-bg-success-emphasis"></span> <span style="background-color:#ededed !important;;width: 1.0%;" itemprop="keywords" data-view-component="true" class="Progress-item color-bg-success-emphasis"></span> </span></div> <ul class="list-style-none"> <li class="d-inline"> <a class="d-inline-flex flex-items-center flex-nowrap Link--secondary no-underline text-small mr-3" href="/QwenLM/Qwen/search?l=python" data-ga-click="Repository, language stats search click, location:repo overview"> <svg style="color:#3572A5;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill mr-2"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> <span class="color-fg-default text-bold mr-1">Python</span> <span>62.8%</span> </a> </li> <li class="d-inline"> <a class="d-inline-flex flex-items-center flex-nowrap Link--secondary no-underline text-small mr-3" href="/QwenLM/Qwen/search?l=jupyter-notebook" data-ga-click="Repository, language stats search click, location:repo overview"> <svg style="color:#DA5B0B;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill mr-2"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> <span class="color-fg-default text-bold mr-1">Jupyter Notebook</span> <span>30.8%</span> </a> </li> <li class="d-inline"> <a class="d-inline-flex flex-items-center flex-nowrap Link--secondary no-underline text-small mr-3" href="/QwenLM/Qwen/search?l=shell" data-ga-click="Repository, language stats search click, location:repo overview"> <svg style="color:#89e051;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill mr-2"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> <span class="color-fg-default text-bold mr-1">Shell</span> <span>5.4%</span> </a> </li> <li class="d-inline"> <span class="d-inline-flex flex-items-center flex-nowrap text-small mr-3"> <svg style="color:#ededed;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill mr-2"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> <span class="color-fg-default text-bold mr-1">Other</span> <span>1.0%</span> </span> </li> </ul> </div> </div> </div> </div> </div></div> </div> </div> </turbo-frame> </main> </div> </div> <footer class="footer pt-8 pb-6 f6 color-fg-muted p-responsive" role="contentinfo" > <h2 class='sr-only'>Footer</h2> <div class="d-flex flex-justify-center flex-items-center flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap"> <div class="d-flex flex-items-center flex-shrink-0 mx-2"> <a aria-label="Homepage" title="GitHub" class="footer-octicon mr-2" href="https://github.com"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M12.5.75C6.146.75 1 5.896 1 12.25c0 5.089 3.292 9.387 7.863 10.91.575.101.79-.244.79-.546 0-.273-.014-1.178-.014-2.142-2.889.532-3.636-.704-3.866-1.35-.13-.331-.69-1.352-1.18-1.625-.402-.216-.977-.748-.014-.762.906-.014 1.553.834 1.769 1.179 1.035 1.74 2.688 1.25 3.349.948.1-.747.402-1.25.733-1.538-2.559-.287-5.232-1.279-5.232-5.678 0-1.25.445-2.285 1.178-3.09-.115-.288-.517-1.467.115-3.048 0 0 .963-.302 3.163 1.179.92-.259 1.897-.388 2.875-.388.977 0 1.955.13 2.875.388 2.2-1.495 3.162-1.179 3.162-1.179.633 1.581.23 2.76.115 3.048.733.805 1.179 1.825 1.179 3.09 0 4.413-2.688 5.39-5.247 5.678.417.36.776 1.05.776 2.128 0 1.538-.014 2.774-.014 3.162 0 .302.216.662.79.547C20.709 21.637 24 17.324 24 12.25 24 5.896 18.854.75 12.5.75Z"></path> </svg> </a> <span> © 2025 GitHub, Inc. </span> </div> <nav aria-label="Footer"> <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3> <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading"> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to Terms","label":"text:terms"}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to privacy","label":"text:privacy"}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to security","label":"text:security"}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to status","label":"text:status"}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to docs","label":"text:docs"}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to contact","label":"text:contact"}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a> </li> <li class="mx-2" > <cookie-consent-link> <button type="button" class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent" data-action="click:cookie-consent-link#showConsentManagement" data-analytics-event="{"location":"footer","action":"cookies","context":"subfooter","tag":"link","label":"cookies_link_subfooter_footer"}" > Manage cookies </button> </cookie-consent-link> </li> <li class="mx-2"> <cookie-consent-link> <button type="button" class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent" data-action="click:cookie-consent-link#showConsentManagement" data-analytics-event="{"location":"footer","action":"dont_share_info","context":"subfooter","tag":"link","label":"dont_share_info_link_subfooter_footer"}" > Do not share my personal information </button> </cookie-consent-link> </li> </ul> </nav> </div> </footer> <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999" data-initial-cookie-consent-allowed="" data-cookie-consent-required="false"></ghcc-consent> <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> You can’t perform that action at this time. </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details> </template> <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div> </div> <template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </clipboard-copy> </div> </template> <template id="snippet-clipboard-copy-button-unpositioned"> <div class="zeroclipboard-container"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </clipboard-copy> </div> </template> </div> <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div> <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div> </body> </html>