Slide 1

Slide 1 text

೔ຊΞΠɾϏʔɾΤϜגࣜձࣾ ςΫϊϩδʔࣄۀຊ෦ ΧελϚʔɾαΫηεࣄۀ෦ ϓϦϯγύϧɾϚωʔδϟʔ େ੢ জ "LJSB0OJTIJ!JCNDPN IUUQTMJOLFEJODPNJOPOJBL XBUTPOYBJ %PKP ੜ੒"*ͱ޲͖߹͏ͨΊͷ४උฤ

Slide 2

Slide 2 text

ࣗݾ঺հ 1SPQFSUZ 7BMVF ࢯ໊ େ੢ জ Y-JOLFE*O POJBL *5ۀքྺ ೥໨ ௚ۙͷ৬ྺ Microsoft ೥ *#.೥໨ ࠓ೥ͷ݄͔Β೥໨ )BTI5BH ͍͍Ͷ͐੩Ԭੜ׆RVBOUJD ࠲ӈͷ໏ ౿·Εͯ΋ͳ্ཱ͓͕ͪΔಓͷ૲ Α͘࢖͏ٕ ೴಺ม׵Ͱࣗ෼ΛϙδςΟϒʹ IUUQTXXXGBDFCPPLDPNBLJSBPOJTIJ 'BDFCPPLʮ͓ʹ͋͘ʯͰݕࡧ

Slide 3

Slide 3 text

໨త ϏδωεͷͨΊͷ"*ɺ*#.XBUTPOYBJΛ஌Δ "*ΞϓϦΛ࣮ߦ͢ΔͨΊͷٕज़΍γεςϜߏ੒Λ஌Δ ΦʔϓϯιʔεʹΑΔ"*ٕज़ͷ͍͔ͭ͘Λ஌Δ ΰʔϧ *#.XBUTPOYBJ%FNPαΠτΛࢼͯ͠ΈΔ ΦʔϓϯιʔεʹΑΔ"*ٕज़Λࢼͯ͠ΈΔ ͜ͷηογϣϯʹ͍ͭͯ

Slide 4

Slide 4 text

%FNPΛݟͯײ͡·͠ΐ͏ εϥΠυ͚ͩͷߨԋͰ͸ͳ͘ɺ%FNPΛަ͑ͨηογϣϯΛఏڙ͠·͢ श͏ΑΓ׳Ε·͠ΐ͏ ٕज़Λମݧ͢ΔͨΊͷԋशΛ௨ͯ͡ɺٕज़ΛֶͿ͖͔͚ͬΛ࡞Γ·͢ ࣭໰େ׻ܴɺηογϣϯΛҰॹʹ࡞Γ·͠ΐ͏ ߨࢣࣗ਎΋ֶͼͳ͕ΒηογϣϯΛ࣮ࢪ͍ͯ͠·͢ օ͞Μ͔Β΋ؾ෇͖΍ϑΟʔυόοΫΛͲΜͲΜڞ༗͍ͯͩ͘͠͞ ػցֶशϞσϧ΍"*ϞσϧɺXBUTPOYBJΛ༑ୡʹ͠Α͏ ࠷ऴ໨ඪ͸ɺօ͞Μ͕طଘͷϞσϧΛ࢖ͬͯɺ"*ΞϓϦΛ։ൃ͠ɺར༻ ͢Δ͜ͱͰ͢ ୭΋͕࣮ߦͰ͖ͳ͍ɾ೉қ౓͕ߴ͍ςʔϚʹ͸৮Ε·ͤΜ ػցֶशϞσϧ΍"*ϞσϧΛθϩ͔Β։ൃ͢Δੈք͸औΓ্͛·ͤΜ XBUTPOYBJ%PKPͷάϥϯυɾϧʔϧ

Slide 5

Slide 5 text

XBUTPOYBJ%PKPୈճͱୈճ ճ λΠτϧ ࣮ࢪ೔ ੜ੒"*ͱ޲͖߹͏ͨΊͷ४උฤ ਫ *#.XBUTPOYBJΛ׆༻͢Δʹ͋ͨΓɺੜ੒"*ͱ ޲͖߹͏ͨΊʹ஌͓ͬͯ͘ͱྑ͍ٕज़ʹ͍ͭͯɺ ޿͘ઙֶ͘ͼ·͢ɻಛʹલఏ஌ࣝ͸ෆཁͰ͕͢ɺ 1ZUIPOݴޠΛ஌͓ͬͯ͘ͱɺཧղ͕ਂ·Γ·͢ɻ Φʔϓϯιʔε΍طଘͷϥΠϒϥϦΛ࢖ͬͯੜ੒ "*Λಈ࡞ͤ͞ΔͨΊͷ؀ڥͷશମ૾Λ஌Δ͜ͱͰɺ "*ϓϥοτϑΥʔϜͰ͋Δ*#. XBUTPOYBJͷओ ཁͳٕज़ཁૉΛֶΜͰ͍͖·͠ΐ͏ɻ ੜ੒"*Λ࢖ͬͨΞϓϦ։ൃɺೖ໳ฤ ਫ *#.XBUTPOYBJͷϓϩϯϓτϥϘΛ࢖ͬͯେن໛ ݴޠϞσϧΛૢ࡞͢Δํ๏ɺग़དྷ্͕ͬͨϓϩϯ ϓτΛΞϓϦ͔Βݺͼग़͢ํ๏Λֶͼ·͢ɻ *#. XBUTPOYBJʹ಺ଂ͞Ε͍ͯΔେن໛ݴޠϞσ ϧΛ஌Γɺ͍ΖΜͳϞσϧΛ࣮ࡍʹࢼ͍͖ͯ͠· ͠ΐ͏ɻ

Slide 6

Slide 6 text

XBUTPOYBJ%PKPୈճͱୈճ ճ λΠτϧ ࣮ࢪ೔ ϓϩϯϓτΤϯδχΞϦϯάೖ໳ ਫ େن໛ݴޠϞσϧΛૢ࡞͢ΔͨΊͷϓϩϯϓτΛ ࡞੒͢Δ্Ͱɺิॿతͳ৘ใΛՃ࣭͑ͯ໰ͷҙਤ Λ໌֬ʹ͢Δํ๏ɺྫࣔʹΑΓճ౴ͷਫ਼౓ΛߴΊ Δํ๏ͳͲʹֶ͍ͭͯͼ·͢ɻେن໛ݴޠϞσϧ ʹվྑΛՃ͑ͣʹɺظ଴ͨ͠ճ౴ʹ͚ۙͮΔํ๏ Λࢼ͍͖ͯ͠·͠ΐ͏ɻ ੜ੒"*Λ࢖ͬͨΞϓϦ։ൃɺԠ༻ ฤ ਫ େن໛ݴޠϞσϧͷ੍໿ࣄ߲Λ৐Γӽ͑ΔͨΊʹɺ 3"(΍-BOH$IBJOΛ࢖ͬͨ"*ΞϓϦͷ։ൃʹͭ ֶ͍ͯͼ·͢ɻ͜Ε·ͰͷճΑΓ΋एׯ೉қ౓͕ ্͕Γ·͕͢ɺαϯϓϧίʔυΛݟͳ͕Βɺงғ ؾΛ௫Έɺօ͞Μ͕։ൃ͍ͨ͠"*ΞϓϦͷ׬੒ ౓ΛߴΊ͍͖ͯ·͠ΐ͏ɻ

Slide 7

Slide 7 text

XBUTPOYBJ%PKPୈճͱୈճ ճ λΠτϧ ࣮ࢪ೔ ϑΝΠϯνϡʔχϯάͱ *OTUSVDU-BC ਫ ࣭໰ͱ౴͑Λ༻ҙ͢Δ͜ͱͰɺେن໛ݴޠϞσ ϧʹ৽͍͠஌ࣝΛ௥Ճ͢ΔͨΊͷϑΝΠϯ νϡʔχϯάͷํ๏Λֶͼ·͢ɻ·ͨɺاۀಠ ࣗͷେن໛ݴޠϞσϧͷܧଓతͳվྑʹ࠷దͳ *OTUSVDU-BCʹֶ͍ͭͯͼ·͢ɻ ܧଓతͳ"*ΞϓϦ։ൃͱల։ ਫ ͜Ε·Ͱֶश͖ͯͨ͜͠ͱΛ૊Έ߹Θͤͯɺେ ن໛ݴޠϞσϧΛར༻ͨ͠"*ΞϓϦͷܧଓతͳ ։ൃͱల։ͷํ๏Λֶͼ·͢ɻاۀಠࣗͷ"*Ξ ϓϦ͚ͩͰ͸ͳ͘ɺ"*Λ૊ΈࠐΜͩιϦϡʔ γϣϯͷܧଓతͳൃలɺύʔτφʔΤίγες Ϝ΁ͷൃలͳͲΛҰॹʹߟ͍͖͑ͯ·͢ɻ

Slide 8

Slide 8 text

օ͞Μ͸ɺੜ੒"*Λ࢖ͬͯɺͲΜͳະདྷΛ࡞Γ͍ͨͰ͔͢ʁ օ͞Μͷؾ࣋ͪʹ͍ۙ΋ͷΛҰͭɺνϟοτཝʹ਺ࣈͰճ౴͍ͯͩ͘͠͞ɻ "*ΞγελϯτΛ࡞Γɺۀ຿ΛΑΓޮ཰Α͘ਐΊ͍ͨ ίʔσΟϯάΛࢧԉ͢Δ"*Λ࡞Γɺ։ൃظؒΛ୹ॖ͍ͨ͠ ઐ໳Ոͷ஌ࣝΛूΊͨ"*Λ࡞Γɺ͋ΒΏΔੜ࢈ੑΛ޲্͍ͨ͠ اۀσʔλΛֶΜͩ"*ϞσϧΛ࡞ΓɺϏδωεͷՁ஋ʹܨ͍͛ͨ ଞͷاۀͱڠۀͯ͠"*ιϦϡʔγϣϯΛ։ൃ͠ɺൢച͍ͨ͠ ੜ੒"*Λ࢖ͬͯΈ͍͕ͨɺԿ͔Β࢝Ίͯྑ͍͔Θ͔Βͳ͍ ·ͣ͸ࣗ෼ࣗ਎͕ੜ੒"*Λֶͼɺ"*ਓࡐʹͳ͍͖͍ͬͯͨ ࣭໰

Slide 9

Slide 9 text

γϯϓϧͳϢʔεέʔεͰখ͘͞"*Λ׆༻͠ͳ͕Βɺ"*ΞϓϦΛ։ൃ͠ɺ ஈ֊తʹൃలͤ͞ɺۀ຿ͷσδλϧԽΛਐԽͤ͞Δ ϏδωεͷͨΊͷ"*ɺϢʔεέʔε จॻੜ੒ ࣭ٙԠ౴ ίʔυੜ੒ ෼ྨ ݴ༿ͷநग़ ཁ໿ ݕࡧʴཁ໿ 3"( ࣗಈԽ 3"(3FUSJFWBM"VHNFOUFE(FOFSBUJPOɺ"*Ϟσϧ͕஌Βͳ͍৘ใΛݕࡧ͠ɺͦͷ݁ՌΛ࢖ͬͯ"*ϞσϧͰςΩετΛੜ੒͢Δ ςΩετ ੜ੒ ຋༁

Slide 10

Slide 10 text

ந৅Խ͞Εͨ"*ΞϓϦͷߏ଄ ೖྗ ΫΤϦʔ ग़ྗ "*--.ΞϓϦ ϏδωεɾϩδοΫ "*Ϟσϧ ػցֶशϞσϧ ϥΠϒϥϦ"1* খ࢝͘͞Ίͯɺ ར༻͠ͳ͕Βൃలͤ͞Δ ೔ຊޠϞσϧ͚ͩʹ߆Βͳ͍ ·ͨϞσϧ͸ਐԽ͢Δ "*ΞϓϦͷ࣮ߦ؀ڥ ʢ"*ϓϥοτϑΥʔϜʣ ΞϓϦΛ ίϯςφԽ͓ͯ͘͠ͱ ؅ཧ͕؆୯ʹͳΔ

Slide 11

Slide 11 text

*#.XBUTPOYBJੜ੒"*ɺػցֶशɺ/PUFCPPLͰͷର࿩ॲཧͳͲ 4BB4Λ׆༻͢Ε͹ɺࠓ͙͢ʹখ࢝͘͞ΊΒΕ·͢ *#.XBUTPOYBJɺ"*ΞϓϦ༻ͷϓϥοτϑΥʔϜ νϟοτܗࣜͰͷར༻ ϓϩϯϓτ࡞੒πʔϧͱ ֎෦ΞϓϦ͔Βͷϓϩϯϓτ࣮ߦ IUUQTXXXJCNDPNKQKBQSPEVDUTXBUTPOYBJ จॻIUUQTKQUPLEBUBQMBUGPSNDMPVEJCNDPNEPDTDPOUFOUXTKHFUUJOHTUBSUFEXFMDPNFNBJOIUNM DPOUFYUXYBVEJFODFXEQ

Slide 12

Slide 12 text

*#.XBUTPOYBJ%FNPαΠτ IUUQTEBUBQMBUGPSNDMPVEJCNDPNDIBUMPHJO ͓࣋ͪͷ*%ͰϩάΠϯ *#.*% (PPHMFΞΧ΢ϯτ -JOLFE*OΞΧ΢ϯτ

Slide 13

Slide 13 text

*#.XBUTPOYBJ%FNPαΠτ ཤྺ Ϟσϧͷબ୒

Slide 14

Slide 14 text

IUUQTKQUPLEBUBQMBUGPSNDMPVEJCNDPNSFHJTUSBUJPOTUFQPOF DPOUFYUXYQSFTFMFDU@SFHJPOUSVF *#.XBUTPOYBJແྉධՁ൛ *#.$MPVEͷ೔τϥΠΞϧɾ ΞΧ΢ϯτΛ࡞੒ ແྉ࿮ͷXBUTPOYBJ؀ڥ ɾ8BUTPO4UVEJP ɾ8BUTPO.BDIJOF-FBSOJOH ɾ*#.$MPVE0CKFDU4UPSBHF ΫϨδοτΧʔυΛొ࿥͢Δͱ ैྔ՝ۚΞΧ΢ϯτͱͯ͠ɺ *#.$MPVEͷશػೳ͕༗ޮ

Slide 15

Slide 15 text

"*Ϟσϧɺ࣮ମ͸χϡʔϥϧωοτϫʔΫʢ਺஋ԋࢉʣ ෳ਺ͷӅΕ૚ ೖྗ૚ ग़ྗ૚ ϞσϧͷॏΈ͚ͮ ֶश͞Εͨύϥϝʔλʔʣ TBGFUFOTPSTͱ͍͏ܗࣜͷόΠφϦʔϑΝΠϧ܈

Slide 16

Slide 16 text

χʔζʹ߹Θͤͨج൫Ϟσϧͷબ୒ μϥεσʔληϯλʔ ਪ঑Ϟσϧ ඇਪ঑Ϟσϧ "*ϞσϧͷਐԽʹ߹Θͤͯɺ ৽͍͠Ϟσϧ΁ͷҠߦ͕ඞਢ

Slide 17

Slide 17 text

χʔζʹ߹Θͤͨج൫Ϟσϧͷબ୒ ౦ژσʔληϯλʔ

Slide 18

Slide 18 text

ࢀߟ*#.XBUTPOYBJͷٕज़ελοΫ IUUQTEFWFMPQFSJCNDPNBSUJDMFTBXCUIFPQFOTPVSDFFDPTZTUFNPGXBUTPOY XBUTPOYBJ͸Φʔϓϯͳٕज़Λ ׆༻ͨ͠"*ϓϥοτϑΥʔϜ ˞શ͕ͯΦʔϓϯιʔεͰ͸͋Γ·ͤΜ ੡඼ʹ͸*#.͕஌తࡒ࢈ݖΛ༗͢Δίʔυ΋ ؚ·Ε͍ͯ·͢

Slide 19

Slide 19 text

ֶशࡁΈͷσʔλΛ࢖ͬͯɺςΩετ΍ը૾ͳͲΛੜ੒͢Δ"*ΞϓϦ ੜ੒ʹ͸"*ϞσϧΛ࢖ͬͨܭࢉʢ"*ਪ࿦ʣ͕ඞਢɺ(16΍/16Λར༻ ୯ͳΔνϟοτϘοτ΍σʔλϕʔεͰ͸ͳ͍͜ͱʹ஫ҙ ੜ੒"*ɺͦͷ࣮ମ͸"*ΞϓϦ ೖྗ ΫΤϦʔ ग़ྗ ճ౴ "*ΞϓϦ ϏδωεɾϩδοΫ "*Ϟσϧ ϥΠϒϥϦ"1* "*ΞϓϦͷ࣮ߦ؀ڥ ʢ"*ϓϥοτϑΥʔϜϋʔυ΢ΣΞͱιϑτ΢ΣΞʣ ೖྗ ग़ྗ લॲཧ ޙॲཧ ϓϩϯϓτ ։ൃ ΞϓϦ։ൃͱల։ όʔδϣϯ؅ཧ ΞϓϦͷධՁ ϞσϧͷධՁ Ϟσϧͷ؅ཧ "1*࡞੒

Slide 20

Slide 20 text

ήʔϜ΍ΤϯλʔςΠϯϝϯτ ݐங΍޻ۀɺߴ౓ͳࢹ֮ԽɾՄࢹԽΛཁ͢Δۀ຿ "*΍σʔλαΠΤϯεɺ(1(16 (FOFSBM1VSQPTF(16 ͷԠ༻ (16 (SBQIJDT1SPDFTTJOH6OJU 𝑎!! ⋯ 𝑎!" ⋮ ⋱ ⋮ 𝑎#! ⋯ 𝑎#" 𝑝! ⋮ 𝑝" = ? 𝑎!! ⋯ 𝑎!" ⋮ ⋱ ⋮ 𝑎#! ⋯ 𝑎#" 𝑝!! ⋯ 𝑝!$ ⋮ ⋱ ⋮ 𝑝"! ⋯ 𝑝"$ = ? (16͸%ը໘ͷඳըͷΈͳΒͣɺ ߦྻԋࢉɺฒྻॲཧ͕ಘҙ ˣ "*ϞσϧʹΑΔܭࢉ ਪ࿦ ΋ಘҙ (16ʹՃ͑ͯɺ"*ਪ࿦ʹಛԽͨ͠ /16 /FVSBM1SPDFTTJOH6OJU ͷ ར༻΋஫໨͞Ε͍ͯΔ

Slide 21

Slide 21 text

Ұൠ޲͚(16ͷྫ/7*%*"(F'PSDF359 https://www.gainward.com/main/vgapro.php?id=1162&lang=jp /7*%*""EB-PWFMBDFʢΤΠμɾϥϒϨεʣ"SDIJUFDUVSF https://www.nvidia.com/ja-jp/geforce/ada-lovelace-architecture/ ओͳεϖοΫ τϥϯδελ਺ 763ԯ CUDA Core (γΣʔμϓϩηοα) ਺ 16,384 Tensor Core਺ 512 RT Core਺ 128 GPU ΫϩοΫ 2.23GHz (ϒʔετ࣌ 2.52GHz) TDP 450W PCIe 4.0઀ଓ https://www.4gamer.net/games/656/G065603/20221010003/

Slide 22

Slide 22 text

αεςφϏϦςΟʔɺΑΓফඅిྗͷ௿͍"*ϓϩηοαͷ׆༻ *#."*6ɺ(PPHMF5SJMMJVNɺ"845SBJOJVNɺ.JDSPTPGU"[VSF.BJB ΫϥΠΞϯτଆσόΠεͷ׆༻ *OUFM"*1$ɺ".%3Z[FO"*ɺ.JDSPTPGU$PQJMPU1$ɺ/7*%*"359"*1$ (PPHMF(FNJOJ/BOP "QQMF*OUFMMJHFODF খ͞ͳݴޠϞσϧͷ࣮༻Խɺ8FCϒϥ΢βʔ಺ͷੜ੒"*࣮ߦ ࣮ݧஈ֊ .JDSPTPGU1IJɺ8FC(16ɺ8FC// "*ؔ࿈ɺ࠷ۙͷςΫϊϩδʔ͔Βײ͡ΒΕΔ͜ͱ

Slide 23

Slide 23 text

8JOEPXT%JSFDU.-/16(16 *OUFM/16 "*#PPTU Λಈ͔͢ 8JOEPXTΞϓϦ 0//9SVOUJNF %JSFDU.- *OUFM/16 "*#PPTU 8JOEPXTΞϓϦ %JSFDU.- (16 %JSFDU% ಈըͷϦΞϧλΠϜ௒ղ૾දࣔ IUUQTMFBSONJDSPTPGUDPNKBKQXJOEPXTBJEJSFDUNMENM

Slide 24

Slide 24 text

8FC(16 IUUQTIVHHJOHGBDFDPTQBDFT9FOPWBFYQFSJNFOUBMQIJXFCHQV

Slide 25

Slide 25 text

8FC// IUUQTNJDSPTPGUHJUIVCJPXFCOOEFWFMPQFSQSFWJFXEFNPTTEUVSCP

Slide 26

Slide 26 text

"*ਪ࿦ͷ࣮ߦ؀ڥɺશମΛ၆ᛌ͢Δ IUUQTQZQJPSH IUUQTIVHHJOHGBDFDP ίϯϐϡʔλʔ 8JOEPXT-JOVY04 1ZUIPO 1Z5PSDIͳͲ $16 (16ϝϞϦ ϝϞϦ (16 ϝϞϦ (16ϝϞϦ /7.F 44% (16υϥΠό (1(16ԋࢉϥΠϒϥϦ ྫ/7*%*"$6%" "*ϞσϧΛར༻ͨ͠ΞϓϦ ϋʔυ΢ΣΞந৅ԽϨΠϠʔ )BSEXBSF"CTUSBDUJPO-BZFS $IJQ ηοτ /FUXPSL *OUFSGBDF طଘͷ"*Ϟσϧ ࢲ͕࣮ͨͪ૷͢Δਪ࿦༻ͷίʔυ "*ϞσϧΛ࢖ͬͨܭࢉ طଘͷϥΠϒϥϦ ిݯϢχοτ

Slide 27

Slide 27 text

1ZUIPOݴޠͷϓϩάϥϛϯά IUUQTXXXQZUIPOPSH

Slide 28

Slide 28 text

.JDSPTPGU4UPSFΛ։͖ɺ8JOEPXTλʔϛφϧΛΠϯετʔϧ IUUQTBQQTNJDSPTPGUDPNEFUBJMOEYIL 8JOEPXT4VCTZTUFNGPS-JOVYΛΠϯετʔϧɺ6CVOUV؀ڥΛ࡞੒ ؅ཧऀݖݶͰ1PXFS4IFMMΛ։͍ͯɺ࣍ͷίϚϯυΛ࣮ߦ wsl --install -d Ubuntu-22.04 ΠϯετʔϧޙʹγεςϜΛ࠶ىಈ͠ɺ1PXFS4IFMM͔Β࣍ͷίϚϯυΛೖྗͯ͠ɺ6CVOUVΛ࣮ߦ wsl -d Ubuntu-22.04 6CVOUV͕ىಈͨ͠ΒɺϢʔβʔ໊ͱύεϫʔυΛઃఆ ޷͖ͳ໊લͱύεϫʔυͰ0,ɺϝϞΛ๨Εͣʹ Enter new UNIX username: ilab New password: llm Retype password: llm ؀ڥͷΞοϓσʔτ ύεϫʔυೖྗ͕ඞཁ sudo apt update sudo apt upgrade 1ZUIPOͷόʔδϣϯ֬ೝ python3 --version 1ZUIPOͷ࣮ߦ؀ڥΛ੔͑Δ 8JOEPXT8JOEPXT ஫ɿ1ZUIPOͷ࠷৽όʔδϣϯ͸ ͜ͷ%PKPͰ͸Λ࢖͍͖ͬͯ·͢ 7JTVBM4UVEJP$PEFΛΠϯετʔϧ https://code.visualstudio.com/Download 7JTVBM4UVEJP$PEF༻ͷ֦ுػೳ 1ZUIPOͱ84-ΛΠϯετʔϧ

Slide 29

Slide 29 text

ଓ͖ 1ZUIPOͷ࣮ߦ؀ڥΛ੔͑Δ8JOEPXT8JOEPXT QZFOWͷΠϯετʔϧ curl https://pyenv.run | bash echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc source ~/.bashrc 1ZUIPOͷΠϯετʔϧ TVEPBQUJOTUBMMCVJMEFTTFOUJBMMJCTTMEFW[MJCHEFWMJCC[EFWMJCSFBEMJOFEFWMJCTRMJUFEFWDVSMMJCODVSTFTXEFWY[VUJMTULEFWMJCYNMEFWMJCYNMTFDEFWMJCGGJEFWMJCM[NBEFW pyenv install 3.10.14 pyenv global 3.10.14 python --version # ʮPython 3.10.14ʯ͕දࣔ͞Ε͍ͯΕ͹ɺOK

Slide 30

Slide 30 text

λʔϛφϧΛ্ཱͪ͛ɺ9DPEFDPNNBOEMJOFUPPMΛΠϯετʔϧ xcode-select –install )PNFCSFXΛΠϯετʔϧ ࣮ߦޙʹදࣔ͞ΕΔ/FYUTUFQTΛ࣮ߦͯ͠ɺ1"5)Λ௨͢͜ͱ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" )PNFCSFXΛ࢖ͬͯɺQZFOWΛΠϯετʔϧ brew update brew install pyenv ؀ڥม਺ͷઃఆ (zsh޲͚) echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc source ~/.zshrc QZFOWΛ࢖ͬͯɺ1ZUIPOΛΠϯετʔϧ brew install openssl readline sqlite3 xz zlib tcl-tk pyenv install 3.10.14 )PNFCSFXΛ࢖ͬͯɺ7JTVBM4UVEJP$PEFΛΠϯετʔϧ brew install --cask visual-studio-code 1ZUIPOͷ࣮ߦ؀ڥΛ੔͑Δ NBD04

Slide 31

Slide 31 text

ϗʔϜσΟϨΫτϦͷԼʹ࡞ۀ༻ϑΥϧμͱͯ͠XYBJΛ࡞Δ cd ~ mkdir wxai cd wxai 1ZUIPOͷԾ૝؀ڥWFOWΛ࡞Δ python -m venv venv 1ZUIPOͷԾ૝؀ڥWFOWΛ༗ޮԽ͢Δ source venv/bin/activate 1ZUIPOͷԾ૝؀ڥΛ࡞Δ -JOVYNBDڞ௨

Slide 32

Slide 32 text

1ZUIPO1BDLBHF*OEFY IUUQTQZQJPSHQSPKFDUUSBOTGPSNFST IUUQTQZQJPSH

Slide 33

Slide 33 text

1ZUPSDI ଟ૚ʹΑΔχϡʔϥϧωοτϫʔΫΛ ࢖༻ͨ͠ػցֶशͷϑϨʔϜϫʔΫ 'BDFCPPL"*3FTFBSDI ݱ.FUB ͕։ൃ ೥ʹΦʔϓϯιʔεԽ ೥ʹ1ZUPSDI'PVOEBUJPO͕؅ཧ -JOVY'PVOEBUJPOͷҰ෦ ͦͷޙɺ*#.͸1ZUPSDI'PVOEBUJPOͷ ϝϯόʔͱͳΓ1ZUPSDIͷൃలʹߩݙத IUUQTQZUPSDIPSHHFUTUBSUFEMPDBMMZ

Slide 34

Slide 34 text

-JOVY 6CVOUVPO8JOEPXT WFSTJPO # CPU (ར༻͍ͯ͠ΔPCʹNVIDIA GPU͕౥ࡌ͞Ε͍ͯͳ͍৔߹) pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu # CUDA 12.1 (NVIDIA GPUΛ࢖͑ΔPCͷ৔߹) wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run sudo sh cuda_12.1.0_530.30.02_linux.run pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 –index-url https://download.pytorch.org/whl/cu121 NBD04 "QQMF4JMJDPO... pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 NBD04 *OUFM$16 # Intel CPUΛ౥ࡌͨ͠mac޲͚ͷ࠷ऴϦϦʔε͸ Pytorch 2.2·Ͱ ৄࡉ͸ͪ͜Β pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 1ZUPSDIͷΠϯετʔϧ

Slide 35

Slide 35 text

)VHHJOH'BDF IUUQTIVHHJOHGBDFDP աڈʹ։࠵ͨ͠ʮ"*ΞϓϦ%PKPʯ΋ࢀߟʹ͍ͯͩ͘͠͞ ୈճ(16Λ׆༻ͯ͠ੜ੒ܥ"*ʹ৮ΕͯΈΑ͏εϥΠυಈը ୈճ)VHHJOH'BDF5SBOTGPSNFSTೖ໳εϥΠυ ୈճ)VHHJOH'BDF5SBOTGPSNFSTϞσϧͷνϡʔχϯάೖ໳εϥΠυ

Slide 36

Slide 36 text

🤗5SBOTGPSNFST IUUQTIVHHJOHGBDFDPEPDTUSBOTGPSNFSTWKBJOEFY ೔ຊޠΛར༻͢ΔલఏͰͷ४උ QJQJOTUBMMUSBOTGPSNFST QJQJOTUBMMTFOUFODFQJFDF IUUQTXXXPSFJMMZDPKQCPPLT

Slide 37

Slide 37 text

)VHHJOH'BDFͰެ։͞Ε͍ͯΔ*#.(SBOJUFϞσϧ (SBOJUF4QFDVMBUPSTσίʔυΛߴ଎Խ (SBOJUF$PEF.PEFMTίʔυੜ੒༻ (SBOJUF(FP4QBUJBM.PEFM஍ཧۭؒ༻ (SBOJUF5JNF4FSJFT.PEFMT࣌ܥྻ༧ଌ༻ ྫɿϕωνΞϥάʔϯͷைҐ༧ଌ IUUQTNFEJVNDPN!EBWJEQSPJFUUJ@QSFEJDUJOHWFOFUJBOMBHPPOUJEFMFWFMTXJUINVMUJWBSJBUFUJNFTFSJFTNPEFMJOHCBGEG άϥφΠτɺ΍Βͳ͍ͱʂ IUUQTIVHHJOHGBDFDPJCNHSBOJUF

Slide 38

Slide 38 text

JCNHSBOJUFHSBOJUFCDPEFJOTUSVDUΛಈ͔ͯ͠Έͨ

Slide 39

Slide 39 text

import time from transformers import AutoModelForCausalLM, AutoTokenizer device = "cuda" # Apple Silicon౥ࡌͷmac؀ڥʹ͓͚Δ஫ҙ: # device = "mps" ͷ৔߹͸λʔϛφϧ্Ͱ࣍ͷ؀ڥม਺͕ඞཁ # export PYTORCH_ENABLE_MPS_FALLBACK=1 model_path = "ibm-granite/granite-3b-code-instruct" tokenizer = AutoTokenizer.from_pretrained(model_path) model = AutoModelForCausalLM.from_pretrained(model_path) model.to(device) def generate_code(prompt): start = time.perf_counter() # change input text as desired chat = [ { "role": "user", "content": prompt }, ] chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True) # tokenize the text input_tokens = tokenizer(chat, return_tensors="pt") # transfer tokenized inputs to the device for i in input_tokens: input_tokens[i] = input_tokens[i].to(device) ࢀߟHSBOJUFCDPEFJOTUSVDUΛ࢖ͬͨίʔυੜ੒ྫ # generate output tokens # Θ͔Γ΍͍͢Α͏ʹύϥϝʔλ͸࠷௿ݶͷΈ # generateϝιουʹ౉͢ύϥϝʔλ͸దٓमਖ਼͍ͯͩ͘͠͞ output = model.generate(**input_tokens, max_new_tokens=1000) # decode output tokens into text output = tokenizer.batch_decode(output) # ݁Ռग़ྗ for i in output: print(i) end = time.perf_counter() print(">>>task completed:"+str(end-start)) return output def do_conversation(): text = input("Granite Code>") if text == "end": return False result = generate_code(text) return True while True: res = do_conversation() if res == False: break

Slide 40

Slide 40 text

"*ΞϓϦͱͷ΍ΓऔΓ͸ɺओʹจࣈྻͰɺਓ͕ཧղͰ͖Δ΋ͷ "*ϞσϧΛར༻͢Δܭࢉ͸ʮ਺஋ԋࢉʯɺจࣈ͸τʔΫϯʹม׵ͯ͠ར༻ จࣈ͕τʔΫϯͰ͸ͳ͍͜ͱʹ஫ҙ ˞͜ͷ࢓༷ʹΑΓੜ੒݁ՌΛԿจࣈҎ಺Ͱग़ྗɺͱ͍͏໋ྩʹ͸޲͔ͳ͍ จࣈྻͱτʔΫϯ 5PLFO ਓ΍γεςϜ͕ ೖྗͨ͠ςΩετ จࣈྻ͔Β τʔΫϯ΁ τʔΫϯ͔Β จࣈྻ΁ ਪ࿦Ͱར༻͢Δ "*Ϟσϧ ೖྗ ग़ྗ 𝑒! ⋮ 𝑒" 𝑟! ⋮ 𝑟" ੜ੒͞Εͨ ςΩετ ਺஋ϕΫτϧ ਺஋ϕΫτϧ IUUQTXXXJCNDPNEPDTKBXBUTPOYTBBT UPQJDTPMVUJPOTUPLFOT IUUQTIVHHJOHGBDFDPEPDTUSBOTGPSNFSTNBJO@DMBTTFTUPLFOJ[FS

Slide 41

Slide 41 text

# t.py ͱͯ͠อଘ from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") encoded = tokenizer("We are very happy to show you the 🤗 Transformers library.") print(encoded) ࣮ߦ݁Ռ Downloading tokenizer_config.json: 100%|█| 48.0/48.0 [00:00<00:00, Downloading config.json: 100%|████| 570/570 [00:00<00:00, 4.90MB/s] Downloading vocab.txt: 100%|█████| 232k/232k [00:00<00:00, 745kB/s] Downloading tokenizer.json: 100%|█| 466k/466k [00:00<00:00, 1.03MB/ {'input_ids': [101, 2057, 2024, 2200, 3407, 2000, 2265, 2017, 1996, 100, 19081, 3075, 1012, 102], 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} ࢀߟจࣈྻͷτʔΫϯԽ

Slide 42

Slide 42 text

ࢀߟ"*ΞϓϦͷٕज़ελοΫ ਤ͸Լه63-ΑΓҾ༻ IUUQTB[DPNFNFSHJOHBSDIJUFDUVSFTGPSMMNBQQMJDBUJPOT ݱ࣌఺Ͱͷશମ૾ ˞ٕज़͸ৗʹਐԽ͍ͯ͠Δ

Slide 43

Slide 43 text

XBUTPOYBJͷΑ͏ͳ"*ϓϥοτϑΥʔϜ͕ඞཁͳཧ༝ ΞϓϦʢ8FCϢʔβʔΠϯλʔϑΣΠεʣ ΞϓϦɾϓϥοτϑΥʔϜ "*ΞϓϦ Ϗδωεɾ ϩδοΫ "*Ϟσϧ ϥΠϒϥϦ"1* "*ΞϓϦɾϓϥοτϑΥʔϜ ໰͍߹Θͤ ੜ੒݁Ռ ཤྺ σʔλ ࢖༻ྔ σʔλ "*ͷ࣮ݧ͸ΦʔϓϯιʔεͰ΋Մೳ ҰํɺاۀϨϕϧ΁ͷల։͸՝୊͕ଟ͍ 4BB4൛ͷXBUTPOYBJΛ࢖͑͹ɺ ΞϓϦ։ൃɺల։ɺӡ༻ʹूதͰ͖Δ

Slide 44

Slide 44 text

ϏδωεͷͨΊͷ"*ɺ*#.XBUTPOYBJΛ஌Δ "*ΞϓϦΛ࣮ߦ͢ΔͨΊͷٕज़΍γεςϜߏ੒Λ஌Δ ΦʔϓϯιʔεʹΑΔ"*ٕज़ͷ͍͔ͭ͘Λ஌Δ $BMMUPBDUJPOT *#.XBUTPOYBJ%FNPαΠτɺXBUTPOYBJແྉධՁ൛Λࢼͯ͠Έ·͠ΐ͏ 1ZUIPOɺ1ZUPSDIɺ7JTVBM4UVEJP$PEFΛΠϯετʔϧ͠·͠ΐ͏ ΦʔϓϯιʔεʹΑΔ"*ٕज़Λࢼͯ͠Έ·͠ΐ͏ ·ͱΊ

Slide 45

Slide 45 text

ϫʔΫγϣοϓɺηογϣϯɺ͓Αͼࢿྉ͸ɺ*#.·ͨ͸ηογϣϯൃදऀʹΑͬͯ४උ͞ΕɺͦΕͧΕಠࣗͷݟղΛ൓өͨ͠΋ͷͰ͢ɻͦΕΒ͸৘ใ ఏڙͷ໨తͷΈͰఏڙ͞Ε͓ͯΓɺ͍͔ͳΔࢀՃऀʹରͯ͠΋๏཯త·ͨ͸ͦͷଞͷࢦಋ΍ॿݴΛҙਤͨ͠΋ͷͰ͸ͳ͘ɺ·ͨ*#.੡඼΍αʔϏε͕͓ ٬༷ʹద༻͋Δಛఆͷ๏ྩʹద߹͢Δ͜ͱΛอূ͢Δ΋ͷͰ΋͋Γ·ͤΜɻຊߨԋࢿྉʹؚ·Ε͍ͯΔ৘ใʹ͍ͭͯ͸ɺ׬શੑͱਖ਼֬ੑΛظ͢ΔΑ͏౒ Ί͓ͯΓ·͕͢ɺʮݱঢ়ͷ··ʯఏڙ͞Εɺ໌ࣔ·ͨ͸໧ࣔʹ͔͔ΘΒͣɺ঎ۀੑɺಛఆͷ໨త΁ͷద߹ੑɺඇ৵֐ੑΛؚΊɺ͍͔ͳΔอূ΋൐Θͳ͍ ΋ͷͱ͠·͢ɻຊߨԋࢿྉ·ͨ͸ͦͷଞͷࢿྉͷ࢖༻ʹΑͬͯɺ͋Δ͍͸ͦͷଞͷؔ࿈ʹΑͬͯɺ͍͔ͳΔଛ֐͕ੜͨ͡৔߹΋ɺ*#.͸੹೚ΛෛΘͳ͍ ΋ͷͱ͠·͢ɻ ຊߨԋࢿྉͰݴٴ͞ΕΔ*#.੡඼ɺϓϩάϥϜɺ·ͨ͸αʔϏε͸ɺ*#.͕ϏδωεΛߦ͍ͬͯΔ͢΂ͯͷࠃɾ஍ҬͰ͝ఏڙՄೳͳΘ͚ Ͱ͸͋Γ·ͤΜɻຊߨԋࢿྉͰݴٴ͞ΕΔকདྷͷల๬ʢ੡඼ϦϦʔε೔෇΍੡඼ػೳΛؚΉʣ͸ɺࢢ৔ػձ·ͨ͸ͦͷଞͷཁҼʹج͍ͮͯ*#.ಠࣗͷܾ ఆݖΛ΋͍ͬͯͭͰ΋มߋͰ͖Δ΋ͷͱ͠ɺকདྷͷ੡඼·ͨ͸ػೳ͕࢖༻ՄೳʹͳΔ͜ͱɺ΋͘͠͸ಛఆͷ݁ՌΛ֬໿͢Δ͜ͱΛҙਤ͢Δ΋ͷͰ͸͋Γ ·ͤΜɻຊߨԋࢿྉ͸ɺݴٴ͞ΕΔ *#.੡඼·ͨ͸αʔϏεʹద༻͋Δܖ໿৚݅Λมߋ͢Δ΋ͷͰ΋ɺ௥Ճͷද໌·ͨ͸อূΛҙਤ͢Δ΋ͷͰ΋͋Γ· ͤΜɻ ຊߨԋࢿྉʹؚ·Ε͍ͯΔ಺༰͸ɺࢀՃऀͷ׆ಈʹΑͬͯಛఆͷ݁Ռ͕ੜ͡Δͱड़΂Δɺ·ͨ͸҉ࣔ͢Δ͜ͱΛҙਤͨ͠΋ͷͰ΋ɺ·ͨͦͷΑ͏ͳ݁Ռ ΛੜΉ΋ͷͰ΋͋Γ·ͤΜɻ ύϑΥʔϚϯε͸ɺ؅ཧ͞Εͨ؀ڥʹ͓͍ͯඪ४తͳ*#.ϕϯνϚʔΫΛ࢖༻ͨ͠ଌఆͱ༧ଌʹج͍͍ͮͯ·͢ɻϢʔβʔ ͕ܦݧ͢Δ࣮ࡍͷεϧʔϓοτ΍ύϑΥʔϚϯε͸ɺϢʔβʔͷδϣϒɾετϦʔϜʹ͓͚ΔϚϧνϓϩάϥϛϯάͷྔɺೖग़ྗߏ੒ɺετϨʔδߏ੒ɺ ͓Αͼॲཧ͞ΕΔϫʔΫϩʔυͳͲͷߟྀࣄ߲ΛؚΉɺ਺ଟ͘ͷཁҼʹԠͯ͡มԽ͠·͢ɻ͕ͨͬͯ͠ɺݸʑͷϢʔβʔ͕͜͜Ͱड़΂ΒΕ͍ͯΔ΋ͷͱ ಉ༷ͷ݁ՌΛಘΒΕΔͱ֬໿͢Δ΋ͷͰ͸͋Γ·ͤΜɻهड़͞Ε͍ͯΔ͢΂ͯͷ͓٬༷ࣄྫ͸ɺͦΕΒͷ͓٬༷͕ͲͷΑ͏ʹ*#.੡඼Λ࢖༻͔ͨ͠ɺ· ͨͦΕΒͷ͓٬༷͕ୡ੒ͨ݁͠Ռͷ࣮ྫͱͯࣔ͠͞Εͨ΋ͷͰ͢ɻ࣮ࡍͷ؀ڥίετ͓ΑͼύϑΥʔϚϯεಛੑ͸ɺ͓٬༷͝ͱʹҟͳΔ৔߹͕͋Γ·͢ɻ • *#.ɺ*#.ϩΰɺJCNDPNɺ%C *#.XBUTPOY͸ɺ ੈքͷଟ͘ͷࠃͰొ࿥͞Εͨ*OUFSOBUJPOBM#VTJOFTT.BDIJOFT$PSQPSBUJPOͷ঎ඪͰ͢ɻଞͷ੡඼໊͓Αͼ αʔϏε໊౳͸ɺͦΕͧΕ*#.·ͨ͸֤ࣾͷ঎ඪͰ͋Δ৔߹͕͋Γ·͢ɻݱ࣌఺Ͱͷ *#.ͷ঎ඪϦετʹ͍ͭͯ͸ɺXXXJCNDPNMFHBMDPQZUSBEFTIUNMΛ͝ཡ͘ ͍ͩ͞ɻ • 3FE)BUɺ3FE)BU0QFO4IJGUɺ3FE)BU"OTJCMF͸ɺ3FE)BU*OD·ͨ͸ࢠձࣾͷถࠃ͓Αͼͦͷଞͷࠃʹ͓͚Δ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ • .JDSPTPGU 8JOEPXT "[VSF.BJB %JSFDU9 %JSFDU% .JDSPTPGU#VJME͸ .JDSPTPGU$PSQPSBUJPOͷถࠃ͓Αͼͦͷଞͷࠃʹ͓͚Δ঎ඪͰ͢ • "84 "845SBJOJVN͸"NB[PO8FC4FSWJDFT *ODͷ঎ඪͰ͢ɻ • (PPHMF (FNJOJ͸ (PPHMF--$ͷ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ɻ • /7*%*" /7*%*"(F'PSDF͸/7*%*"$PSQPSBUJPOͷ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ɻ • ".% ".%3Z[FO͸"EWBODFE.JDSP%FWJDFT *ODͷ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ɻ • "QQMF .BDCPPL NBD04 9DPEF "QQMF*OUFMMJHFODF͸"QQMF*ODͷ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ɻ

Slide 46

Slide 46 text

No content