{"id":21372,"date":"2025-02-17T09:29:53","date_gmt":"2025-02-17T01:29:53","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=21372"},"modified":"2025-02-17T09:29:53","modified_gmt":"2025-02-17T01:29:53","slug":"uigen-t1-qwen-7b","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/ja\/uigen-t1-qwen-7b\/","title":{"rendered":"UIGEN-T1-Qwen-7b\uff1a\u751f\u6210HTML\u548cCSS UI\u7ec4\u4ef6\u7684\u4e13\u7528\u6a21\u578b"},"content":{"rendered":"<p>UIGEN-T1 \u662f\u4e00\u4e2a\u62e5\u6709 70 \u4ebf\u53c2\u6570\u7684 <a href=\"https:\/\/www.kdjingpai.com\/ja\/transformer\/\">Transformer<\/a> \u6a21\u578b\uff0c\u5b83\u57fa\u4e8e Qwen2.5-Coder-7B-Instruct \u8fdb\u884c\u5fae\u8c03\uff0c\u4e13\u4e3a\u57fa\u4e8e\u63a8\u7406\u7684 UI \u751f\u6210\u800c\u8bbe\u8ba1\u3002\u5b83\u5229\u7528\u590d\u6742\u7684\u94fe\u5f0f\u601d\u8003\uff08chain-of-thought\uff09\u65b9\u6cd5\u6765\u751f\u6210\u5f3a\u5927\u7684\u57fa\u4e8e HTML \u548c CSS \u7684 UI \u7ec4\u4ef6\u3002\u76ee\u524d\uff0c\u5b83\u4ec5\u9650\u4e8e\u4eea\u8868\u677f\u3001\u7740\u9646\u9875\u548c\u6ce8\u518c\u8868\u5355\u7b49\u57fa\u672c\u5e94\u7528\u3002\u8be5\u6a21\u578b\u901a\u8fc7\u63a8\u7406\u8bbe\u8ba1\u539f\u5219\u751f\u6210 HTML \u548c CSS \u5e03\u5c40\u3002\u867d\u7136\u5b83\u5177\u6709\u5f3a\u5927\u7684\u94fe\u5f0f\u601d\u8003\u63a8\u7406\u8fc7\u7a0b\uff0c\u4f46\u76ee\u524d\u4ec5\u9650\u4e8e\u57fa\u4e8e\u6587\u672c\u7684 UI \u5143\u7d20\u548c\u66f4\u7b80\u5355\u7684\u524d\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u6a21\u578b\u64c5\u957f\u4eea\u8868\u677f\u3001\u7740\u9646\u9875\u548c\u6ce8\u518c\u8868\u5355\uff0c\u4f46\u7f3a\u4e4f\u9ad8\u7ea7\u4ea4\u4e92\u6027\uff08\u4f8b\u5982\uff0c\u5927\u91cf\u4f7f\u7528 JavaScript \u7684\u529f\u80fd\uff09\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21374\" title=\"UIGEN-T1-Qwen-7b\uff1a\u751f\u6210HTML\u548cCSS UI\u7ec4\u4ef6\u7684\u4e13\u7528\u6a21\u578b-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/e4b7734fe95b1cc.jpg\" alt=\"UIGEN-T1-Qwen-7b\uff1a\u751f\u6210HTML\u548cCSS UI\u7ec4\u4ef6\u7684\u4e13\u7528\u6a21\u578b-1\" width=\"1030\" height=\"697\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/e4b7734fe95b1cc.jpg 1030w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/e4b7734fe95b1cc-220x150.jpg 220w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/e4b7734fe95b1cc-768x520.jpg 768w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21373\" title=\"UIGEN-T1-Qwen-7b\uff1a\u751f\u6210HTML\u548cCSS UI\u7ec4\u4ef6\u7684\u4e13\u7528\u6a21\u578b-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/22fed5081c25a84.jpg\" alt=\"UIGEN-T1-Qwen-7b\uff1a\u751f\u6210HTML\u548cCSS UI\u7ec4\u4ef6\u7684\u4e13\u7528\u6a21\u578b-1\" width=\"1294\" height=\"737\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/22fed5081c25a84.jpg 1294w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/22fed5081c25a84-768x437.jpg 768w\" sizes=\"auto, (max-width: 1294px) 100vw, 1294px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>UI\u751f\u6210<\/strong>\uff1a\u80fd\u591f\u751f\u6210HTML\u548cCSS\u4ee3\u7801\uff0c\u7528\u4e8e\u6784\u5efa\u7528\u6237\u754c\u9762\u3002<\/li>\n<li><strong>\u94fe\u5f0f\u601d\u8003<\/strong>\uff1a\u5229\u7528\u94fe\u5f0f\u601d\u8003\u65b9\u6cd5\uff0c\u901a\u8fc7\u63a8\u7406\u8bbe\u8ba1\u539f\u5219\u751f\u6210UI\u5e03\u5c40\u3002<\/li>\n<li><strong>\u9002\u7528\u573a\u666f<\/strong>\uff1a\u7279\u522b\u9002\u7528\u4e8e\u4eea\u8868\u677f\u3001\u7740\u9646\u9875\u548c\u6ce8\u518c\u8868\u5355\u7b49\u57fa\u672c\u5e94\u7528\u3002<\/li>\n<li><strong>\u4ee3\u7801\u751f\u6210<\/strong>\uff1a\u751f\u6210\u7684\u4ee3\u7801\u7ed3\u6784\u826f\u597d\u4e14\u6709\u6548\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<p>UIGEN-T1 \u80fd\u591f\u6839\u636e\u63d0\u793a\u8bcd\u751f\u6210\u7528\u6237\u754c\u9762\uff08UI\uff09\u7684 HTML \u548c CSS \u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528\u8be5\u6a21\u578b\u7684\u57fa\u672c\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n<p><strong>1. \u51c6\u5907\u73af\u5883<\/strong><\/p>\n<p>\u786e\u4fdd\u4f60\u7684\u73af\u5883\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a<\/p>\n<ul>\n<li><strong>\u786c\u4ef6<\/strong>\uff1a\u5efa\u8bae\u81f3\u5c11 12GB VRAM\u3002<\/li>\n<li><strong>\u8f6f\u4ef6<\/strong>\uff1a\n<ul>\n<li>Transformers \u5e93 (Hugging Face)<\/li>\n<li>PyTorch<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>2. \u5b89\u88c5\u4f9d\u8d56<\/strong><\/p>\n<pre><code>pip install transformers\r\npip install torch\r\n<\/code><\/pre>\n<p><strong>3. \u57fa\u672c\u63a8\u7406\u4ee3\u7801<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u8fdb\u884c\u57fa\u672c\u63a8\u7406\uff1a<\/p>\n<pre><code>from transformers import AutoModelForCausalLM, AutoTokenizer\r\nmodel_name = \"smirki\/UIGEN-T1\"\r\ntokenizer = AutoTokenizer.from_pretrained(model_name)\r\nmodel = AutoModelForCausalLM.from_pretrained(model_name).to(\"cuda\")\r\nprompt = \"\"\"&lt;|im_start|&gt;user\r\nMake a dark-themed dashboard for an oil rig.&lt;|im_end|&gt;\r\n&lt;|im_start|&gt;assistant\r\n&lt;|im_start|&gt;think\r\n\"\"\"\r\ninputs = tokenizer(prompt, return_tensors=\"pt\").to(\"cuda\")\r\noutputs = model.generate(**inputs, max_new_tokens=12012, do_sample=True, temperature=0.7) #max <a href=\"https:\/\/www.kdjingpai.com\/ja\/tokenization\/\">tokens<\/a> has to be greater than 12k\r\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\r\n<\/code><\/pre>\n<p><strong>4. \u4ee3\u7801\u89e3\u91ca<\/strong><\/p>\n<ul>\n<li><strong>\u6a21\u578b\u52a0\u8f7d<\/strong>\uff1a\n<ul>\n<li><code>model_name = \"smirki\/UIGEN-T1\"<\/code>\uff1a\u6307\u5b9a\u6a21\u578b\u540d\u79f0\u3002<\/li>\n<li><code>tokenizer = AutoTokenizer.from_pretrained(model_name)<\/code>\uff1a\u52a0\u8f7d\u9884\u8bad\u7ec3\u7684\u5206\u8bcd\u5668\u3002<\/li>\n<li><code>model = AutoModelForCausalLM.from_pretrained(model_name).to(\"cuda\")<\/code>\uff1a\u52a0\u8f7d\u6a21\u578b\u5e76\u5c06\u5176\u79fb\u52a8\u5230 CUDA \u8bbe\u5907\u4e0a\uff08\u5982\u679c\u53ef\u7528\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u63d0\u793a\u8bcd\u51c6\u5907<\/strong>\uff1a\n<ul>\n<li><code>prompt<\/code>\uff1a\u5305\u542b\u7528\u6237\u6307\u4ee4\u7684\u63d0\u793a\u8bcd\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u77f3\u6cb9\u94bb\u4e95\u5e73\u53f0\u7684\u6df1\u8272\u4e3b\u9898\u4eea\u8868\u677f\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6a21\u578b\u63a8\u7406<\/strong>\uff1a\n<ul>\n<li><code>inputs = tokenizer(prompt, return_tensors=\"pt\").to(\"cuda\")<\/code>\uff1a\u5c06\u63d0\u793a\u8bcd\u8f6c\u6362\u4e3a PyTorch \u5f20\u91cf\uff0c\u5e76\u5c06\u5176\u79fb\u52a8\u5230 CUDA \u8bbe\u5907\u4e0a\u3002<\/li>\n<li><code>outputs = model.generate(**inputs, max_new_tokens=12012, do_sample=True, temperature=0.7)<\/code>\uff1a\u751f\u6210\u8f93\u51fa\u3002\n<ul>\n<li><code>max_new_tokens<\/code>\uff1a\u8bbe\u7f6e\u751f\u6210\u4ee4\u724c\u7684\u6700\u5927\u6570\u91cf\uff0c\u5fc5\u987b\u5927\u4e8e 12012\u3002<\/li>\n<li><code>do_sample<\/code>\uff1a\u542f\u7528\u91c7\u6837\u4ee5\u589e\u52a0\u751f\u6210\u5185\u5bb9\u7684\u591a\u6837\u6027\u3002<\/li>\n<li><code>temperature<\/code>\uff1a\u63a7\u5236\u751f\u6210\u5185\u5bb9\u7684\u591a\u6837\u6027\uff1b\u8f83\u4f4e\u7684\u503c\u4f7f\u8f93\u51fa\u66f4\u5177\u786e\u5b9a\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u8f93\u51fa\u89e3\u7801<\/strong>\uff1a\n<ul>\n<li><code>print(tokenizer.decode(outputs, skip_special_tokens=True))<\/code>\uff1a\u5c06\u751f\u6210\u7684\u4ee4\u724c\u89e3\u7801\u4e3a\u6587\u672c\uff0c\u5e76\u6253\u5370\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>5. \u4f7f\u7528\u6280\u5de7<\/strong><\/p>\n<ul>\n<li><strong>\u63d0\u793a\u8bcd\u5de5\u7a0b<\/strong>\uff1a\n<ul>\n<li>\u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684\u63a8\u7406\u6548\u679c\uff0c\u53ef\u80fd\u9700\u8981\u5728\u8f93\u5165\u63d0\u793a\u7684\u672b\u5c3e\u6dfb\u52a0 &#8220;answer&#8221;\u3002<\/li>\n<li>\u793a\u4f8b\uff1a<code>Make a dark-themed dashboard for an oil rig. answer<\/code><\/li>\n<\/ul>\n<\/li>\n<li><strong>\u624b\u52a8\u540e\u5904\u7406<\/strong>\uff1a\n<ul>\n<li>\u751f\u6210\u7684 UI \u4ee3\u7801\u53ef\u80fd\u9700\u8981\u624b\u52a8\u540e\u5904\u7406\uff0c\u4ee5\u8fdb\u884c\u5b8c\u5584\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5fae\u8c03<\/strong>\uff1a\n<ul>\n<li>\u53ef\u4ee5\u9488\u5bf9\u7279\u5b9a\u7684\u524d\u7aef\u6846\u67b6\uff08\u5982 React\u3001Vue \u7b49\uff09\u8fdb\u4e00\u6b65\u5fae\u8c03\u6a21\u578b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>6. \u5c40\u9650\u6027<\/strong><\/p>\n<ul>\n<li><strong>\u4e0d\u9002\u7528\u4e8e\u590d\u6742\u7684\u524d\u7aef\u5e94\u7528<\/strong>\uff1a\u8be5\u6a21\u578b\u4e0d\u9002\u7528\u4e8e\u6d89\u53ca\u5927\u91cf JavaScript \u4ea4\u4e92\u7684\u590d\u6742\u524d\u7aef\u5e94\u7528\u3002<\/li>\n<li><strong>\u8bbe\u8ba1\u591a\u6837\u6027\u6709\u9650<\/strong>\uff1a\u6a21\u578b\u504f\u5411\u4e8e\u57fa\u672c\u7684\u524d\u7aef\u5e03\u5c40\uff0c\u53ef\u80fd\u65e0\u6cd5\u751f\u6210\u6709\u521b\u610f\u6216\u9ad8\u7ea7\u7684 UI \u5e03\u5c40\u3002<\/li>\n<li><strong>\u4f2a\u5f71\u95ee\u9898<\/strong>\uff1a\u67d0\u4e9b\u8f93\u51fa\u53ef\u80fd\u5305\u542b\u683c\u5f0f\u4f2a\u5f71\u3002<\/li>\n<\/ul>\n<p><strong>7. \u9002\u7528\u573a\u666f<\/strong><\/p>\n<ul>\n<li><strong>\u4eea\u8868\u677f<\/strong>\uff1a\u5feb\u901f\u751f\u6210\u6570\u636e\u5c55\u793a\u754c\u9762\u3002<\/li>\n<li><strong>\u7740\u9646\u9875<\/strong>\uff1a\u521b\u5efa\u7b80\u5355\u7684\u5355\u9875\u5e94\u7528\u3002<\/li>\n<li><strong>\u6ce8\u518c\u8868\u5355<\/strong>\uff1a\u751f\u6210\u7528\u6237\u6ce8\u518c\u754c\u9762\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>UIGEN-T1 \u662f\u4e00\u4e2a\u62e5\u6709 70 \u4ebf\u53c2\u6570\u7684 Transformer \u6a21\u578b\uff0c\u5b83\u57fa\u4e8e Qwen2.5-Coder-7B-Instruct \u8fdb\u884c\u5fae\u8c03\uff0c\u4e13\u4e3a\u57fa\u4e8e\u63a8\u7406\u7684 UI \u751f\u6210\u800c\u8bbe\u8ba1\u3002\u5b83\u5229\u7528\u590d\u6742\u7684\u94fe\u5f0f\u601d\u8003\uff08chain-of-thought\uff09\u65b9\u6cd5&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61850,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230],"class_list":["post-21372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/21372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/comments?post=21372"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/21372\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/media\/61850"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/media?parent=21372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/categories?post=21372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/tags?post=21372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}