<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AI（人工知能） | Men of Letters（メン・オブ・レターズ） &#8211; 論理的思考/業務改善/プログラミング</title>
	<atom:link href="https://laboratory.kazuuu.net/category/ai%ef%bc%88%e4%ba%ba%e5%b7%a5%e7%9f%a5%e8%83%bd%ef%bc%89/feed/" rel="self" type="application/rss+xml" />
	<link>https://laboratory.kazuuu.net</link>
	<description></description>
	<lastBuildDate>Thu, 28 Dec 2023 05:56:46 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://laboratory.kazuuu.net/wp-content/uploads/2021/02/cropped-L-32x32.png</url>
	<title>AI（人工知能） | Men of Letters（メン・オブ・レターズ） &#8211; 論理的思考/業務改善/プログラミング</title>
	<link>https://laboratory.kazuuu.net</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>AIとのペアプログラミング用に設計されたエディタ「Cursor」をインストールする</title>
		<link>https://laboratory.kazuuu.net/install-cursor-an-editor-designed-for-pair-programming-with-ai-windows11/</link>
					<comments>https://laboratory.kazuuu.net/install-cursor-an-editor-designed-for-pair-programming-with-ai-windows11/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Thu, 28 Dec 2023 05:56:46 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=17777</guid>

					<description><![CDATA[AIとのペアプログラミング用に設計されたエディター「Cursor」をインストールすることについて解説しています。（Windows11） 目次 ■環境■Windows版のダウンロード■インストール■サインアップとアカウント [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>AIとのペアプログラミング用に設計されたエディター「Cursor」をインストールすることについて解説しています。（Windows11）</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■環境</a></li><li><a href="#toc2" tabindex="0">■Windows版のダウンロード</a></li><li><a href="#toc3" tabindex="0">■インストール</a></li><li><a href="#toc4" tabindex="0">■サインアップとアカウント登録</a></li><li><a href="#toc5" tabindex="0">■ログイン</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■環境</span></h2>
<p>Windows11</p>
<h2><span id="toc2">■Windows版のダウンロード</span></h2>
<p>まずはCursor（<a href="https://cursor.sh/">https://cursor.sh/</a>）にWebブラウザを用いてアクセスします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142.png"><img decoding="async" class="alignnone size-medium wp-image-17780" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142-300x136.png" alt="" width="300" height="136" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142-300x136.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142-1024x463.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142-768x347.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141142.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>アクセスすると、Cursorのトップページが表示されますので、トップページ上の「Download for Windows」ボタンをクリックします。クリックすると、「Cursor Setup 0.20.2 &#8211; x64.exe」のファイルダウンロードが開始されます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141759.png"><img fetchpriority="high" decoding="async" class="alignnone size-medium wp-image-17781" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141759-300x193.png" alt="" width="300" height="193" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141759-300x193.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141759.png 752w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>ダウンロード開始後、しばらくすると、Webブラウザで指定されている保存場所に「Cursor Setup 0.20.2 &#8211; x64.exe」がダウンロードされます。</p>
<h2><span id="toc3">■インストール</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141920.png"><img decoding="async" class="alignnone size-full wp-image-17782" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-141920.png" alt="" width="275" height="265" /></a></p>
<p>Webブラウザで指定されている場所に保存された「Cursor Setup 0.20.2 &#8211; x64.exe」のファイルをダブルクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17783" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047-300x197.png" alt="" width="300" height="197" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047-300x197.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047-1024x674.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047-768x505.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142047.png 1527w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17784" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601-300x111.png" alt="" width="300" height="111" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601-300x111.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601-1024x378.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601-768x284.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-142601.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、「Cursor」が起動し表示されます。これでインストールは完了です。完了ですが、「Cursor」を起動すると設定画面が表示されます。</p>
<blockquote><p>Shortcuts<br />
You can use the same shortcuts as your old editor.<br />
Default (VSCode)</p>
<p>（ショートカット<br />
以前のエディタと同じショートカットが使えます。<br />
デフォルト（VSCode））</p>
<p>Vim/Emacs<br />
When turned on, we&#8217;ll install the vim / emacs extensions for you.<br />
Default (None)</p>
<p>（ヴィム/エマックス<br />
オンにすると、vim/emacsエクステンションをインストールします。）</p>
<p>Codebase-wide<br />
Compute embeddings automatically to answer codebase- wide questions.<br />
Enabled</p>
<p>（コードベース全体<br />
コードベース全体の質問に答えるために埋め込みを自動的に計算します。<br />
有効）</p>
<p>Language<br />
You can specify a non-English language for the Al.<br />
E.g., Svenska, feat<br />
（言語<br />
Alに英語以外の言語を指定できます。）</p>
<p>Command Line Launch from the command line using `code` or `cursor`.</p>
<p>Install &#8220;code&#8221; command + Install &#8220;cursor&#8221;</p>
<p>（コマンドライン `code` または `cursor` を使ってコマンドラインから起動する。）</p></blockquote>
<p>設定項目は上記にとおりです。今回はデフォルトのままで使用しますので、「Continue」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17785" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012-300x160.png" alt="" width="300" height="160" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012-300x160.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012-1024x546.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012-768x409.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143012.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<blockquote><p>VSCode Extensions<br />
Instantly import your extensions, settings, and keybindings from VSCode to make trying out Cursor simple.<br />
Back<br />
Start from Scratch<br />
Use Extensions</p>
<p>（<br />
VSCode 拡張機能<br />
VSCodeから拡張機能、設定、キーバインドを即座にインポートして、Cursorを簡単に試すことができます。<br />
戻る<br />
ゼロから始める<br />
拡張機能を使う）</p></blockquote>
<p>クリックすると、「VSCode Extensions（VSCode 拡張機能）」が表示される場合があります。今回は「Start from Scratch（ゼロから始める）」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17786" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349-300x208.png" alt="" width="300" height="208" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349-300x208.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349-1024x711.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349-768x533.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143349.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<blockquote><p>Data Preferences</p>
<p>・Help Improve Cursor<br />
To make Cursor better, this option lets us collect usage data. This may include questions in chat, code snippets, or<br />
editor actions.</p>
<p>・Privacy Mode<br />
If you enable Privacy Mode, none of your questions or code will ever be stored by us or any third-party (except for OpenAl which persists prompts for 30 days).</p>
<p>データ環境設定</p>
<p>カーソルの改善<br />
Cursorをより良いものにするために、このオプションで使用データを収集することができます。これには、チャットでの質問、コードスニペット、エディタ操作などが含まれます。<br />
エディタ操作などが含まれます。</p>
<p>プライバシーモード<br />
プライバシーモードを有効にすると、あなたの質問やコードが当社やサードパーティに保存されることはありません（プロンプトを30日間保存するOpenAlを除く）。</p></blockquote>
<p>クリックすると、「Data Preferences（データ環境設定）」が表示されます。2つの選択肢がありますが、今回は「Help Improve Cursor（Cursorの改善）」を選択し、「Continue」ボタンをクリックします。</p>
<h2><span id="toc4">■サインアップとアカウント登録</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17788" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-300x151.png" alt="" width="300" height="151" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-300x151.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-1024x514.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-768x386.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると「Log in」と「Sign Up」ボタンが表示されますので、「Sign Up」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17789" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938-222x300.png" alt="" width="222" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938-222x300.png 222w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938-757x1024.png 757w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938-768x1038.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938-1136x1536.png 1136w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143938.png 1250w" sizes="(max-width: 222px) 100vw, 222px" /></a></p>
<p>クリックするとWebブラウザ上に「Sign up | Cursor（<a href="https://cursor.us.auth0.com/u/signup/identifier">https://cursor.us.auth0.com/u/signup/identifier</a>）」が表示されます。このページでアカウントを作成していきます。今回は、メールアドレスで登録する方法や、GithubアカウントまたはGoogleアカウントを用いて登録する方法がありますが、Googleアカウントを用いて登録を行いますので、「Continue with Google」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144302.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17790" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144302-279x300.png" alt="" width="279" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144302-279x300.png 279w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144302.png 560w" sizes="(max-width: 279px) 100vw, 279px" /></a></p>
<p>クリックすると「Googleにログイン」と表示されたページに移動します。今回はGoogleChromeのWebブラウザを用いてすでに取得しているGoogleアカウントでログインしている状態となっていますので、表示されたページにはGoogleアカウントが表示されます。表示されているGoogleアカウントを選択します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17792" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558-257x300.png" alt="" width="257" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558-257x300.png 257w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558-877x1024.png 877w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558-768x896.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144558.png 1250w" sizes="(max-width: 257px) 100vw, 257px" /></a></p>
<blockquote><p>Cursor is requesting access to your cursor account.</p>
<p>Profile: access to your profile and email<br />
Allow offline access</p>
<p>カーソルはあなたのカーソルアカウントへのアクセスを要求しています。</p>
<p>プロフィール：プロフィールとEメールへのアクセス<br />
オフラインアクセスを許可する</p></blockquote>
<p>選択すると、「Authorize Cursor（https://cursor.us.auth0.com/u/consent）」に移動します。移動したページ内では、上記のメッセージが表示されていますので、アクセスの要求を「Accept（受け入れ）」ボタンをクリックすることで受け入れます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17793" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-300x116.png" alt="" width="300" height="116" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-300x116.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-1024x394.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-768x296.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911.png 1249w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<blockquote>
<div>You may now proceed back to Cursor</div>
<div>If you have any trouble, please contact hi@cursor.sh</div>
<div>これでCursorに戻ることができます。 何か問題がありましたら、hi@cursor.sh までご連絡ください。</div>
</blockquote>
<p>クリックすると、上記のメッセージが表示されたページに移動します。移動後、表示されたページを閉じます。なお、これでアカウントの登録は完了となります。</p>
<h2><span id="toc5">■ログイン</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17788" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-300x151.png" alt="" width="300" height="151" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-300x151.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-1024x514.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725-768x386.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-143725.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>閉じた後に「Cursor」に戻り、今度は「Log in」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17793" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-300x116.png" alt="" width="300" height="116" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-300x116.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-1024x394.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911-768x296.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-144911.png 1249w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<blockquote>
<div>You may now proceed back to Cursor</div>
<div>If you have any trouble, please contact hi@cursor.sh</div>
<div>これでCursorに戻ることができます。 何か問題がありましたら、hi@cursor.sh までご連絡ください。</div>
</blockquote>
<p>クリックすると、再びWebブラウザ上に、先ほど同じメッセージが表示されたページ（https://cursor.sh/loginDeepPage）が表示されます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17794" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347-300x196.png" alt="" width="300" height="196" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347-300x196.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347-1024x671.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347-768x503.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347-1536x1006.png 1536w, https://laboratory.kazuuu.net/wp-content/uploads/2023/12/スクリーンショット-2023-12-28-145347.png 1539w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>表示後、「Cursor」に戻ると、Cursorにログインした状態となり、コードの編集作業が行える状態となります。これで「Cursor」のログインは完了となります。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/install-cursor-an-editor-designed-for-pair-programming-with-ai-windows11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PythonでPaLM APIを用いた言語モデルによるテキスト生成</title>
		<link>https://laboratory.kazuuu.net/text-generation-with-language-model-using-palm-api-in-python/</link>
					<comments>https://laboratory.kazuuu.net/text-generation-with-language-model-using-palm-api-in-python/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Mon, 19 Jun 2023 04:48:36 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<category><![CDATA[Python【初歩から現場実務的なもの】]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=17062</guid>

					<description><![CDATA[PythonでPaLM APIを用いた言語モデルによるテキスト生成を行ってみます。 今回はgoogle-generativeaiを用います。このライブラリ・モジュールはPythonの標準ライブラリではありませんので、事前 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>PythonでPaLM APIを用いた言語モデルによるテキスト生成を行ってみます。</p>
<p>今回はgoogle-generativeaiを用います。このライブラリ・モジュールはPythonの標準ライブラリではありませんので、<a href="https://laboratory.kazuuu.net/python-installation-of-google-generative-ai-high-level-api-client">事前にインストールする必要</a>があります。</p>
<p>またPaLM APIを用いるためには<a href="https://laboratory.kazuuu.net/obtain-an-api-key-that-directly-calls-the-palm-api-in-makersuite/">APIキーを発行する必要があります</a>ので、事前に発行しておく必要があります。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-4" checked><label class="toc-title" for="toc-checkbox-4">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■Python</a></li><li><a href="#toc2" tabindex="0">■PaLM APIを用いた言語モデルによるテキスト生成</a><ol><li><a href="#toc3" tabindex="0">■コード</a></li></ol></li><li><a href="#toc4" tabindex="0">■検証・実行</a></li><li><a href="#toc5" tabindex="0">■備考</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■Python</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16692" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334-300x139.png" alt="" width="300" height="139" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334-300x139.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334-1024x475.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334-768x356.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-29-120334.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>今回のPythonのバージョンは、「3.10.9」を使用しています。（Windows11）（pythonランチャーでの確認）</p>
<h2><span id="toc2">■PaLM APIを用いた言語モデルによるテキスト生成</span></h2>
<p>では、PaLM APIを用いた言語モデルによるテキスト生成を行うため、スクリプトを書いていきます。</p>
<h3><span id="toc3">■コード</span></h3>
<pre>import pprint
import google.generativeai as palm

palm.configure(api_key='発行されたAPIキー')

models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
model = models[0].name

prompt = """
明日の天気を予想してください。
"""

completion = palm.generate_text(
    model=model,
    prompt=prompt,
    temperature=0,
    max_output_tokens=800,
)

print(completion.result)</pre>
<p>まずはモジュールのインポートを行います。pprintというモジュールをインポートしています。これは、結果をきれいに表示するために使用します。次に、google.generativeaiモジュールをpalmという名前でインポートします。このモジュールには、GenerativeAI（Palm）の機能が含まれています。</p>
<p>次に「palm.configure(api_key=&#8217;発行されたAPIキー&#8217;)」と記述し関数を使用して、GenerativeAI（Palm）APIの認証に使用するAPIキーを設定します。「発行されたAPIキー」の部分は、実際のAPIキーに置き換える必要があります。</p>
<p>設定後「models = [m for m in palm.list_models() if &#8216;generateText&#8217; in m.supported_generation_methods]」と記述し関数を使用して利用可能なモデルのリストを取得します。このリストは、GenerativeAI（Palm）が提供するさまざまなモデルを含みます。次にリスト内包表記を使用して「&#8217;generateText&#8217;」というテキスト生成メソッドをサポートしているモデル（models/text-bison-001）のみを抽出します。</p>
<p>その後、model = models[0].nameと記述し、モデルの選択をします。選択後、プロンプトの設定します。prompt変数に、テキスト生成のための入力となるプロンプト（提示文）を設定します。今回は「明日の天気を予想してください。」という日本語の文をプロンプトとして使用します。</p>
<p>設定後、テキスト生成の実行します。</p>
<pre>completion = palm.generate_text(
    model=model,
    prompt=prompt,
    temperature=0,
    max_output_tokens=800,
)</pre>
<p>上記では、palm.generate_text()関数を使用し指定したモデルとプロンプトに基づいてテキスト生成を実行します。model引数には選択したモデルの名前を指定し、prompt引数にはプロンプトを指定します。temperature引数は生成されるテキストの多様性を制御し、max_output_tokens引数は生成されるテキストの最大トークン数を指定します。</p>
<p>最後に「print(completion.result)」と記述し、結果を表示します。</p>
<h2><span id="toc4">■検証・実行</span></h2>
<p>今回書いたスクリプトを「ai_generator.py」という名前でPythonが実行されている作業ディレクトリ（カレントディレクトリ）に保存し、コマンドプロンプトから実行してみます。</p>
<p><a rel="attachment wp-att-17063" href="https://laboratory.kazuuu.net/text-generation-with-language-model-using-palm-api-in-python/%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2023-06-19-134042/"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17063" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042-300x126.png" alt="" width="300" height="126" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042-300x126.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042-1024x429.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042-768x322.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042-1536x644.png 1536w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134042.png 1705w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<pre>Traceback (most recent call last):
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\api_core\grpc_helpers.py", line 72, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\grpc\_channel.py", line 1030, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\grpc\_channel.py", line 910, in _end_unary_response_blocking
    raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: &lt;_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "The requested language is not supported by models/text-bison-001" debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B2404:6800:4004:824::200a%5D:443 {created_time:"2023-06-19T04:27:02.19780269+00:00", grpc_status:3, grpc_message:"The requested language is not supported by models/text-bison-001"}" &gt;

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\user_\ai_generator.py", line 13, in 
    completion = palm.generate_text(
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\generativeai\text.py", line 139, in generate_text
    return _generate_response(client=client, request=request)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\generativeai\text.py", line 159, in _generate_response
    response = client.generate_text(request)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\ai\generativelanguage_v1beta2\services\text_service\client.py", line 641, in generate_text
    response = rpc(
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\api_core\gapic_v1\method.py", line 113, in __call__
    return wrapped_func(*args, **kwargs)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\api_core\grpc_helpers.py", line 74, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 The requested language is not supported by models/text-bison-001</pre>
<p>実行してみると、上記のメッセージが表示されました。メッセージの内容を確認すると、「400 The requested language is not supported by models/text-bison-001（400 要求された言語は、models/text-bison-001 でサポートされません）」という内容です。内容から2023年6月の記事公開時点ではmodels/text-bison-001は、日本語はサポートされてない。</p>
<p>そのため、「テキスト生成のための入力となるプロンプト（提示文）」を日本語から英語に変更し、スクリプトを実行してみます。</p>
<p><a rel="attachment wp-att-17064" href="https://laboratory.kazuuu.net/text-generation-with-language-model-using-palm-api-in-python/%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2023-06-19-134415/"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-17064" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415-300x91.png" alt="" width="300" height="91" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415-300x91.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415-1024x310.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415-768x233.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415-1536x466.png 1536w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-19-134415.png 1603w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<pre>**Tomorrow's Weather Forecast**

* **Day:** Mostly sunny, with a high near 60 degrees Fahrenheit.
* **Night:** Mostly clear, with a low around 40 degrees Fahrenheit.
* **Wind:** Southeast wind 5 to 10 mph.
* **Chance of precipitation:** 0%.

**Summarized:** Tomorrow will be a sunny day with a high near 60 degrees Fahrenheit. The night will be mostly clear with a low around 40 degrees Fahrenheit. There is no chance of precipitation.

（**明日の天気予報** **Day:** Mostly sunny, with high near 60 degrees Fahrenheit. * 夜：**ほとんど晴れ、最低気温は華氏40度前後です。* **Wind:** 南東の風5〜10mph. * 降水確率：0％。**Summarized:** 明日は晴れで、最高気温は華氏60度付近です。夜はほぼ晴れで、最低気温は華氏40度前後でしょう。降水確率はゼロです。）
</pre>
<p>実行してみると、言語モデルによるテキスト生成が行われました。</p>
<h2><span id="toc5">■備考</span></h2>
<p>Q.APIの認証に使用するAPIキーを設定していない場合はどうなるか。</p>
<p>A.下記のようなメッセージが表示されます。</p>
<pre>Traceback (most recent call last):
  File "C:\Users\user_\ai_generator.py", line 4, in 
    models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\generativeai\models.py", line 93, in list_models
    client = get_default_model_client()
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\generativeai\client.py", line 157, in get_default_model_client
    default_model_client = glm.ModelServiceClient(**default_client_config)
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\ai\generativelanguage_v1beta2\services\model_service\client.py", line 427, in __init__
    self._transport = Transport(
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\ai\generativelanguage_v1beta2\services\model_service\transports\grpc.py", line 149, in __init__
    super().__init__(
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\ai\generativelanguage_v1beta2\services\model_service\transports\base.py", line 97, in __init__
    credentials, _ = google.auth.default(
  File "C:\Users\user_\AppData\Roaming\Python\Python310\site-packages\google\auth\_default.py", line 692, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/text-generation-with-language-model-using-palm-api-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>デモ用のHuggingChat v0.2にアクセスする</title>
		<link>https://laboratory.kazuuu.net/access-huggingchat-v0-2-for-demonstration/</link>
					<comments>https://laboratory.kazuuu.net/access-huggingchat-v0-2-for-demonstration/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Sat, 03 Jun 2023 03:49:53 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16786</guid>

					<description><![CDATA[2023年6月3日に、Webブラウザ（GoogleChrome）を用いてHuggingChat（https://huggingface.co/chat/）にアクセスするとHuggingChat v0.2というポップアップ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>2023年6月3日に、Webブラウザ（GoogleChrome）を用いてHuggingChat（<a href="https://huggingface.co/chat/">https://huggingface.co/chat/</a>）にアクセスするとHuggingChat v0.2というポップアップが表示された。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16787" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.38.30-247x300.png" alt="" width="247" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.38.30-247x300.png 247w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.38.30-844x1024.png 844w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.38.30-768x931.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.38.30.png 1250w" sizes="(max-width: 247px) 100vw, 247px" /></p>
<blockquote><p>This application is for demonstration purposes only.<br />
Al is an area of active research with known problems such as biased generation and misinformation. Do not use this application for high-stakes decisions or advice.<br />
Your conversations will be shared with model authors unless you disable it from your settings.</p>
<p>本アプリケーションはデモ用です。<br />
Alは、偏った生成や誤報などの問題が知られている、活発な研究分野です。このアプリケーションを、利害関係の強い決定やアドバイスに使用しないでください。<br />
あなたの会話は、設定から無効にしない限り、モデルの作者と共有されます。</p></blockquote>
<p>ポップアップには上記のように記載されており、HuggingChat v0.2にサインインすることにした。サインインのために「Sign in with Hugging Face」ボタンをクリックする。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16788" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.42.48-271x300.png" alt="" width="271" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.42.48-271x300.png 271w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.42.48-925x1024.png 925w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.42.48-768x850.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.42.48.png 1250w" sizes="(max-width: 271px) 100vw, 271px" /></p>
<blockquote><p>HuggingChat would like to access your Hugging Face account.（HuggingChatは、あなたのHugging Faceのアカウントにアクセスしたいと思います。）</p></blockquote>
<p><a href="https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/">Hugging Faceには事前にアカウント登録を行っている</a>ため、上記のウインドウが表示された。ウインドウ内の「Authorize（認可する）」ボタンをクリックします。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16790" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23-300x188.png" alt="" width="300" height="188" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23-300x188.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23-1024x641.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23-768x481.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23-1536x962.png 1536w, https://laboratory.kazuuu.net/wp-content/uploads/2023/06/スクリーンショット-2023-06-03-12.48.23.png 1560w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>クリック後、HuggingChat（<a href="https://huggingface.co/chat/">https://huggingface.co/chat/</a>）に移動し、ヒューマンフィードバックからの強化学習 (RLHF) と呼ばれる技術を用いた「HuggingChat v0.2」が利用できるようになった。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/access-huggingchat-v0-2-for-demonstration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>数秒で360度の仮想空間を生成できる「Skybox AI」</title>
		<link>https://laboratory.kazuuu.net/skybox-ai-that-can-generate-a-360-degree-virtual-space-in-seconds/</link>
					<comments>https://laboratory.kazuuu.net/skybox-ai-that-can-generate-a-360-degree-virtual-space-in-seconds/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Sat, 27 May 2023 04:51:55 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16664</guid>

					<description><![CDATA[数秒で360度仮想空間を生成できる「Skybox AI」について解説しています。 「Skybox AI（https://skybox.blockadelabs.com/）」はAIを力を使ってテキストから自分だけでのバーチ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>数秒で360度仮想空間を生成できる「Skybox AI」について解説しています。</p>
<p>「Skybox AI（<a href="https://skybox.blockadelabs.com/">https://skybox.blockadelabs.com/</a>）」はAIを力を使ってテキストから自分だけでのバーチャルな世界を数秒で作成できます。</p>
<p>無料アカウントを登録しなければいけないようですが、「Skybox AI（<a href="https://skybox.blockadelabs.com/">https://skybox.blockadelabs.com/</a>）」にアクセスしてみると、アカウントの登録が不要で、プロンプトを入力して生成ができるようです。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16665" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59-300x189.png" alt="" width="300" height="189" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59-300x189.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59-1024x646.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59-768x484.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.44.59.png 1047w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>「Skybox AI（<a href="https://skybox.blockadelabs.com/">https://skybox.blockadelabs.com/</a>）」にアクセスすると、表示された「Dream up your world」に生成した仮想空間のイメージをテキストで入力し、「Digital Painting」をクリックするとプルダウンメニューが表示されスタイルを選択し、「GENERATE」をクリックすると、生成が開始され、しばらくするとプロンプトした通りの仮想空間を生成できます。生成された仮想空間は「DOWNLO（ダウンロード）（jpg形式の画像ファイル）」と「SHARE（シェア）」が行なえます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/skybox-ai-that-can-generate-a-360-degree-virtual-space-in-seconds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【Python】Hugging Face内の言語モデルを使って推論(inference)を実行する</title>
		<link>https://laboratory.kazuuu.net/python-perform-inference-using-the-language-model-in-hugging-face/</link>
					<comments>https://laboratory.kazuuu.net/python-perform-inference-using-the-language-model-in-hugging-face/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Sat, 27 May 2023 04:17:13 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<category><![CDATA[Python【初歩から現場実務的なもの】]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16656</guid>

					<description><![CDATA[Hugging Face内の言語モデルを使って推論(inference)を実行してみます。 実行する際は、事前にアカウント登録と、Hugging FaceのAPIトークン（アクセストークン）を取得しておきます。 目次 ■ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hugging Face内の言語モデルを使って推論(inference)を実行してみます。</p>
<p>実行する際は、事前に<a href="https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/">アカウント登録</a>と、<a href="https://laboratory.kazuuu.net/obtain-an-api-token-access-token-for-hugging-face/">Hugging FaceのAPIトークン（アクセストークン）</a>を取得しておきます。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-10" checked><label class="toc-title" for="toc-checkbox-10">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■今回の環境（Python）</a></li><li><a href="#toc2" tabindex="0">API リクエストによる言語モデルの推論(inference)の実行</a><ol><li><a href="#toc3" tabindex="0">■コード</a></li></ol></li><li><a href="#toc4" tabindex="0">■実行・検証</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■今回の環境（Python）</span></h2>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-15289" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/03/スクリーンショット-2023-03-18-9.12.22-300x101.png" alt="" width="300" height="101" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/03/スクリーンショット-2023-03-18-9.12.22-300x101.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/03/スクリーンショット-2023-03-18-9.12.22.png 462w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>今回のPythonは、バージョン3.9.16を用いる。（なお、Google Colaboratory(Google Colab)を使用。）</p>
<h2><span id="toc2">API リクエストによる言語モデルの推論(inference)の実行</span></h2>
<p>では、API リクエストによる言語モデルの推論(inference)の実行を行うために、コードを書いていきます。</p>
<h3><span id="toc3">■コード</span></h3>
<pre>import requests

API_URL = "https://api-inference.huggingface.co/models/gpt2"
headers = {"Authorization": f"Bearer アクセストークン"}

def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()

output = query({
"inputs": "What is the capital of Japan?",})

print(output)</pre>
<p>Pythonのrequestsモジュールを使用し、Hugging FaceのAPIを介してGPT-2モデル（https://api-inference.huggingface.co/models/gpt2）に問い合わせを行います。</p>
<p>最初に、APIのエンドポイントをAPI_URL変数に設定しています。このURLは、Hugging FaceのモデルAPIのエンドポイントを指定します。</p>
<p>次に、ヘッダー情報をheaders変数に設定しています。このヘッダーには、アクセストークンを含める必要があります。アクセストークンは、Hugging FaceのAPIにアクセスするための認証情報です。このコードでは、Bearerという文字列の後にアクセストークンを記述する必要があります。</p>
<p>query関数は、与えられたペイロード（APIへのリクエストデータ）を使用して、APIにPOSTリクエストを送信します。リクエストの際には、事前に設定したAPIのエンドポイントとヘッダー情報を使用します。そして、APIからのレスポンスをJSON形式で取得し、その結果を返します。</p>
<p>最後に、query関数を使用して具体的な質問（今回は「What is the capital of Japan?」）をAPIに送信し、その結果をoutput変数に格納しています。</p>
<p>output変数には、APIからの応答が含まれています。この応答はJSON形式であり、print()によって出力されます。</p>
<h2><span id="toc4">■実行・検証</span></h2>
<p>このコードセルを保存し、Google Colaboratory上で、セルを実行してみます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16658" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27-300x128.png" alt="" width="300" height="128" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27-300x128.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27-1024x436.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27-768x327.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-12.48.27.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>実行してみると、Hugging FaceのAPIを介してGPT-2モデルの推論(inference)を実行し、応答を出力させることができました。</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/python-perform-inference-using-the-language-model-in-hugging-face/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hugging FaceのInference APIで「{&#8216;error&#8217;: &#8216;Model **** is currently loading&#8217;, &#8216;estimated_time&#8217;: **.*}」を出力される</title>
		<link>https://laboratory.kazuuu.net/hugging-faces-inference-api-outputs-error-model-is-currently-loading-estimated_time-is-output/</link>
					<comments>https://laboratory.kazuuu.net/hugging-faces-inference-api-outputs-error-model-is-currently-loading-estimated_time-is-output/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Sat, 27 May 2023 04:16:52 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16660</guid>

					<description><![CDATA[Hugging FaceのInference APIで「{&#8216;error&#8217;: &#8216;Model **** is currently loading&#8217;, &#8216;estima [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hugging FaceのInference APIで「{&#8216;error&#8217;: &#8216;Model **** is currently loading&#8217;, &#8216;estimated_time&#8217;: **.*}」を出力される。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.07.53.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16661" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.07.53-300x148.png" alt="" width="300" height="148" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.07.53-300x148.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-27-13.07.53.png 769w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Hugging FaceのInference APIを介して言語モデルのInference（推論）を実行させようとすると、「{&#8216;error&#8217;: &#8216;Model ** is currently loading&#8217;, &#8216;estimated_time&#8217;: **}」を出力されることがあります。リクエストされたモデルが現在読み込み中であることを示し、使用することができない状態となっている。モデルの読み込みが完了するまで待つ必要がありますが、待っていっこうに読み込みされない。</p>
<p>この原因を調べてみると、言語モデルの容量が大きすぎるとAPIが扱うことができないようだ。Hugging FaceのInference API（<a href="https://huggingface.co/inference-api">https://huggingface.co/inference-api</a>）でも記載されているが、「Large models (&gt;10gb) require dedicated infrastructure and maintenance to work reliably, we can support this via an enterprise plan with yearly commitment.（大容量モデル（10GB以上）の安定した動作には、専用のインフラとメンテナンスが必要ですが、年間契約によるエンタープライズプランで対応可能です。）」とのこと。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/hugging-faces-inference-api-outputs-error-model-is-currently-loading-estimated_time-is-output/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hugging FaceのAPIトークン（アクセストークン）を取得する</title>
		<link>https://laboratory.kazuuu.net/obtain-an-api-token-access-token-for-hugging-face/</link>
					<comments>https://laboratory.kazuuu.net/obtain-an-api-token-access-token-for-hugging-face/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Fri, 26 May 2023 05:24:32 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16639</guid>

					<description><![CDATA[Hugging FaceのAPIトークン（アクセストークン）を取得することについて解説しています。 まずは、Webブラウザで、AIコミュニティ「Hugging Face」のアカウント登録（「Hugging Face Hu [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hugging FaceのAPIトークン（アクセストークン）を取得することについて解説しています。</p>
<p>まずは、Webブラウザで、<a href="https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/">AIコミュニティ「Hugging Face」のアカウント登録（「Hugging Face Hub」）</a>を行います。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140241.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16641" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140241-270x300.png" alt="" width="270" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140241-270x300.png 270w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140241.png 655w" sizes="(max-width: 270px) 100vw, 270px" /></a></p>
<p>その後、Log In（<a href="https://huggingface.co/login">https://huggingface.co/login</a>）から登録したメールアドレスとパスワードを入力欄に入力し、「Login」ボタンをクリックし、ログインを行います。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16642" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523-300x199.png" alt="" width="300" height="199" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523-300x199.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523-1024x678.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523-768x509.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140523.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックするとログインが完了しますので、右上に表示されているアカウント画像（今回は初期設定）をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140727.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16643" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140727-236x300.png" alt="" width="236" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140727-236x300.png 236w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140727.png 538w" sizes="(max-width: 236px) 100vw, 236px" /></a></p>
<p>クリックするとメニューが表示されますので、メニュー内から「Settings」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16644" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902-300x182.png" alt="" width="300" height="182" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902-300x182.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902-1024x622.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902-768x466.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-140902.png 1326w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると「Profile Settings」などが表示されます。このページの左側にメニューが表示されていますので、メニューから「Access Tokens」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16645" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037-300x117.png" alt="" width="300" height="117" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037-300x117.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037-1024x399.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037-768x299.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141037.png 1324w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると「Access Tokens」の項目が表示されます。「Access tokens programmatically authenticate your identity to the Hugging Face Hub, allowing applications to perform specific actions specified by the scope of permissions (read, write, or admin) granted. Visit the documentation to discover how to use them.（アクセストークンは、Hugging Face Hubに対するあなたのアイデンティティをプログラムで認証し、付与された権限（読み取り、書き込み、または管理）の範囲によって指定された特定のアクションをアプリケーションが実行することを可能にします。アクセス・トークンの使用方法については、ドキュメントをご覧ください。）」と書かれていますので、アクセス・トークンの使用するために「New token」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16646" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355-300x245.png" alt="" width="300" height="245" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355-300x245.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355-1024x836.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355-768x627.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141355.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると「Create a new access token（アクセストークンを新規に作成する）」というウインドウが表示されます。ウインドウ内には「Name」の入力欄がありますのでアクセストークンの名前を入力します。その後「Role」で「read」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16648" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408-300x129.png" alt="" width="300" height="129" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408-300x129.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408-1024x442.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408-768x331.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141408.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、プルダウンメニューが表示され「write」が表示されます。今回は付与する権限として「read（読み取り）」を選択します。書き込みの権限を与える場合はwrite（書き込み）」を選択します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16649" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929-300x226.png" alt="" width="300" height="226" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929-300x226.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929-1024x771.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929-768x578.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-141929.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>選択後、今回は「Name」を「test01」として「Generate a token（トークンを生成する）」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16650" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145-300x115.png" alt="" width="300" height="115" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145-300x115.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145-1024x392.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145-768x294.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-142145.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックするとアクセストークンが生成されます。生成後、「Show」の文字をクリックするとアクセストークンが表示され、「Show」の右側にあるマークをクリックすると、アクセストークンをコピーすることができます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/obtain-an-api-token-access-token-for-hugging-face/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AIコミュニティ「Hugging Face」のアカウント登録</title>
		<link>https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/</link>
					<comments>https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Fri, 26 May 2023 04:55:23 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16630</guid>

					<description><![CDATA[Hugging Faceは、AIモデルで使用される AI の知識と資産の民主化を目的とした人工知能とデータ サイエンスのコミュニティ及びプラットフォームです。 今回は「Hugging Face Hub（https://h [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hugging Faceは、AIモデルで使用される AI の知識と資産の民主化を目的とした人工知能とデータ サイエンスのコミュニティ及びプラットフォームです。</p>
<p>今回は「Hugging Face Hub（<a href="https://huggingface.co/pricing#hub">https://huggingface.co/pricing#hub</a>）」に登録してみますので、Webブラウザを起動し「<a href="https://huggingface.co/">https://huggingface.co/</a>」にアクセスします。※「Hugging Face Hub」では、無制限のモデル、データセット、スペースをホストしたり、最新のML ツールとオープンソースにアクセスすることが無料でできます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16631" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818-300x211.png" alt="" width="300" height="211" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818-300x211.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818-1024x720.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818-768x540.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-132818.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>アクセスするとプラットフォームの右上に「Sign up」ボタンがありますのでこちらをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16632" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1-257x300.png" alt="" width="257" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1-257x300.png 257w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1-878x1024.png 878w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1-768x896.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-02-1.png 1250w" sizes="(max-width: 257px) 100vw, 257px" /></a></p>
<p>クリックするとJoin Hugging Faceと表示されたページ（<a href="https://huggingface.co/join">https://huggingface.co/join</a>）に移動します。ページ内には「Email Address」と表示されていますので、お持ちのメールアドレスをEmail Addressと表示された入力欄に入力します。その後、「Password」と表示された入力欄にパスワードを入力します。その後「Next」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16634" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439-300x288.png" alt="" width="300" height="288" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439-300x288.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439-1024x984.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439-768x738.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133439.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると「Complete your profile」と表示されますので「Username（ユーザー名）」、「Full name（フルネーム）」、「Avatar (optional)（アバター）（オプション）」、「GitHub username（ユーザーネーム） (optional)」、「Homepage (optional)（ホームページ）（オプション）」、「Research interests (optional) 研究関心 (オプション)」を入力します。オプションの場合は入力しなくても構いません。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16636" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918-300x73.png" alt="" width="300" height="73" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918-300x73.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918-1024x248.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918-768x186.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-133918.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>入力後、「I have read and agree with the Terms of Service and the Code of Conduct（利用規約と行動規範を読み、同意します）」のチェックボックスに、Terms of Service（<a href="https://huggingface.co/terms-of-service">https://huggingface.co/terms-of-service</a>）とCode of Conduct（<a href="https://huggingface.co/terms-of-service">https://huggingface.co/code-of-conduct</a>）を翻訳ツール等で翻訳し、同意するためにチェックを入れます。</p>
<p>チェック後「Create Account」ボタンをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-16637" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506-300x155.png" alt="" width="300" height="155" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506-300x155.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506-1024x528.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506-768x396.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/05/スクリーンショット-2023-05-26-134506.png 1245w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、<a href="https://huggingface.co/welcome">https://huggingface.co/welcome</a>のページへ移動します。これでアカウントの登録は完了となりますが、登録の際に入力したメールアドレスに「[Hugging Face] Click this link to confirm your email address」というメールが届いていますので、メール内に記載されているリンクをクリックします。クリックすると「Your email address has been verified successfully.（あなたのメールアドレスは正常に認証されました。）」と<a href="https://huggingface.co/welcome">https://huggingface.co/welcome</a>に表示されます。これで認証が完了し、コミュニティを利用できるようになります。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/sign-up-for-an-account-with-hugging-face-an-ai-community/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【Python】Hugging Face Hub と対話するためのクライアント ライブラリ「huggingface_hub」のインストール</title>
		<link>https://laboratory.kazuuu.net/installation-of-the-client-library-huggingface_hub-to-interact-with-the-hugging-face-hub/</link>
					<comments>https://laboratory.kazuuu.net/installation-of-the-client-library-huggingface_hub-to-interact-with-the-hugging-face-hub/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Fri, 26 May 2023 04:55:10 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<category><![CDATA[Python【初歩から現場実務的なもの】]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=16628</guid>

					<description><![CDATA[Hugging Face Hubと対話するためのクライアント ライブラリ「huggingface_hub」のインストールについて解説しています。 Hugging Face Hubは、90,000を超えるモデル、14,00 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hugging Face Hubと対話するためのクライアント ライブラリ「huggingface_hub」のインストールについて解説しています。</p>
<p>Hugging Face Hubは、90,000を超えるモデル、14,000のデータセット、12,000 のデモを備えたプラットフォームで、ユーザーはML（機械学習）ワークフロー（機械学習モデルの開発と展開のプロセス）で簡単に共同作業できる。</p>
<p>「huggingface_hub（<a href="https://github.com/huggingface/huggingface_hub">https://github.com/huggingface/huggingface_hub</a>）」は、モデル、データセットを簡単にダウンロード、アップロードすることができます。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-18" checked><label class="toc-title" for="toc-checkbox-18">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■Python</a></li><li><a href="#toc2" tabindex="0">■huggingface_hubをインストールする</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■Python</span></h2>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-15847" src="https://laboratory.kazuuu.net/wp-content/uploads/2023/04/スクリーンショット-2023-04-16-090258-300x146.png" alt="" width="300" height="146" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2023/04/スクリーンショット-2023-04-16-090258-300x146.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2023/04/スクリーンショット-2023-04-16-090258-1024x498.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2023/04/スクリーンショット-2023-04-16-090258-768x374.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2023/04/スクリーンショット-2023-04-16-090258.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>今回のPythonのバージョンは、「3.8.5」を使用しています。（Windows11）</p>
<h2><span id="toc2">■huggingface_hubをインストールする</span></h2>
<p>huggingface_hubをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。</p>
<pre>pip install huggingface_hub</pre>
<p>起動後、上記のコマンドを入力し、Enterキーを押します。</p>
<p>なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。</p>
<pre>py -3.8 -m pip install huggingface_hub</pre>
<p>切り替えるために、上記のコマンドを入力し、Enterキーを押します。</p>
<pre>Defaulting to user installation because normal site-packages is not writeable
Collecting huggingface_hub
Downloading huggingface_hub-0.14.1-py3-none-any.whl (224 kB)
|████████████████████████████████| 224 kB 1.7 MB/s
Collecting fsspec
Downloading fsspec-2023.5.0-py3-none-any.whl (160 kB)
|████████████████████████████████| 160 kB 2.2 MB/s
Collecting packaging&gt;=20.9
Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting requests
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting filelock
Using cached filelock-3.12.0-py3-none-any.whl (10 kB)
Collecting tqdm&gt;=4.42.1
Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
Collecting typing-extensions&gt;=3.7.4.3
Downloading typing_extensions-4.6.2-py3-none-any.whl (31 kB)
Collecting pyyaml&gt;=5.1
Using cached PyYAML-6.0-cp38-cp38-win_amd64.whl (155 kB)
Collecting colorama
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting charset-normalizer&lt;4,&gt;=2
Using cached charset_normalizer-3.1.0-cp38-cp38-win_amd64.whl (96 kB)
Collecting urllib3&lt;3,&gt;=1.21.1
Using cached urllib3-2.0.2-py3-none-any.whl (123 kB)
Collecting certifi&gt;=2017.4.17
Using cached certifi-2023.5.7-py3-none-any.whl (156 kB)
Collecting idna&lt;4,&gt;=2.5
Using cached idna-3.4-py3-none-any.whl (61 kB)
Installing collected packages: urllib3, idna, colorama, charset-normalizer, certifi, typing-extensions, tqdm, requests, pyyaml, packaging, fsspec, filelock, huggingface-hub
WARNING: The script normalizer.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script tqdm.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script huggingface-cli.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed certifi-2023.5.7 charset-normalizer-3.1.0 colorama-0.4.6 filelock-3.12.0 fsspec-2023.5.0 huggingface-hub-0.14.1 idna-3.4 packaging-23.1 pyyaml-6.0 requests-2.31.0 tqdm-4.65.0 typing-extensions-4.6.2 urllib3-2.0.2
WARNING: You are using pip version 21.1.1; however, version 23.1.2 is available.
You should consider upgrading via the 'C:\Program Files\Python38\python.exe -m pip install --upgrade pip' command.</pre>
<p>Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、huggingface_hubが正常にインストールされたことになります。</p>
<p>なお、今回はhuggingface_hubのバージョン0.14.1をインストールしました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/installation-of-the-client-library-huggingface_hub-to-interact-with-the-hugging-face-hub/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>汎用人工知能（Artificial general intelligence (AGI)）とは</title>
		<link>https://laboratory.kazuuu.net/what-is-artificial-general-intelligence-agi/</link>
					<comments>https://laboratory.kazuuu.net/what-is-artificial-general-intelligence-agi/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Tue, 28 Feb 2023 20:40:39 +0000</pubDate>
				<category><![CDATA[AI（人工知能）]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=15168</guid>

					<description><![CDATA[汎用人工知能（Artificial general intelligence (AGI)）について解説しています。 汎用人工知能（Artificial general intelligence (AGI)）は、機械が人間 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>汎用人工知能（Artificial general intelligence (AGI)）について解説しています。</p>
<p>汎用人工知能（Artificial general intelligence (AGI)）は、機械が人間と同じように理解し、学習し、知的作業を行う知能と定義。知的作業には、人間と同じような思考や行動も含まれると考えられ、これを模倣して、あらゆる種類の複雑な問題を解決する。</p>
<p>機械が人間と同じように理解し、学習し、知的作業を行うことは、それはもやは人間と何らかかわりはなく、これが実現するのは先の未来で仮想の機械であると言われ、夢物語だと考えられている。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/what-is-artificial-general-intelligence-agi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
