Google Colab
文章推薦指數: 80 %
Colab Pro and Pro+ provide priority access to faster GPUs, longer running notebooks and more memory. Our long term goal is to continue providing a free of ... Skiptocontent Colaboratory FrequentlyAskedQuestions TheBasics WhatisColaboratory?Colaboratory,or“Colab”forshort,isaproductfromGoogleResearch.Colaballowsanybodytowriteandexecutearbitrarypythoncodethroughthebrowser,andisespeciallywellsuitedtomachinelearning,dataanalysisandeducation.Moretechnically,ColabisahostedJupyternotebookservicethatrequiresnosetuptouse,whileprovidingaccessfreeofchargetocomputingresourcesincludingGPUs. Isitreallyfreeofchargetouse?Yes.Colabisfreeofchargetouse. Seemstoogoodtobetrue.Whatarethelimitations?Colabresourcesarenotguaranteedandnotunlimited,andtheusagelimitssometimesfluctuate.ThisisnecessaryforColabtobeabletoprovideresourcesfreeofcharge.Formoredetails,seeResourceLimits UserswhoareinterestedinmorereliableaccesstobetterresourcesmaybeinterestedinColabPro. WhatisthedifferencebetweenJupyterandColab?JupyteristheopensourceprojectonwhichColabisbased.ColaballowsyoutouseandshareJupyternotebookswithotherswithouthavingtodownload,install,orrunanything. UsingColab Wherearemynotebooksstored,andcanIsharethem?ColabnotebooksarestoredinGoogleDrive,orcanbeloadedfromGitHub.ColabnotebookscanbesharedjustasyouwouldwithGoogleDocsorSheets.SimplyclicktheSharebuttonatthetoprightofanyColabnotebook,orfollowtheseGoogleDrivefilesharinginstructions. IfIsharemynotebook,whatwillbeshared?Ifyouchoosetoshareanotebook,thefullcontentsofyournotebook(text,code,output,andcomments)willbeshared.YoucanomitcodecelloutputfrombeingsavedorsharedbyusingEdit>Notebooksettings>Omitcodecelloutputwhensavingthisnotebook.Thevirtualmachineyou’reusing,includinganycustomfilesandlibrariesthatyou’vesetup,willnotbeshared.Soit’sagoodideatoincludecellswhichinstallandloadanycustomlibrariesorfilesthatyournotebookneeds. CanIimportanexistingJupyter/IPythonnotebookintoColab?Yes.Choose"Uploadnotebook"fromtheFilemenu. HowcanIsearchColabnotebooks?YoucansearchColabnotebooksusingGoogleDrive.ClickingontheColablogoatthetopleftofthenotebookviewwillshowallnotebooksinDrive.YoucanalsosearchfornotebooksthatyouhaveopenedrecentlyusingFile>Opennotebook. Whereismycodeexecuted?WhathappenstomyexecutionstateifIclosethebrowserwindow?Codeisexecutedinavirtualmachineprivatetoyouraccount.Virtualmachinesaredeletedwhenidleforawhile,andhaveamaximumlifetimeenforcedbytheColabservice. HowcanIgetmydataout?YoucandownloadanyColabnotebookthatyou’vecreatedfromGoogleDrivefollowingtheseinstructions,orfromwithinColab’sFilemenu.AllColabnotebooksarestoredintheopensourceJupyternotebookformat(.ipynb). HowcanIresetthevirtualmachine(s)mycoderunson,andwhyisthissometimesunavailable?SelectingRuntime>Disconnectanddeleteruntimetoreturnallmanagedvirtualmachinesassignedtoyoutotheiroriginalstate.Thiscanbehelpfulincaseswhereavirtualmachinehasbecomeunhealthye.g.duetoaccidentaloverwriteofsystemfiles,orinstallationofincompatiblesoftware.Colablimitshowoftenthiscanbedonetopreventundueresourceconsumption.Ifanattemptfails,pleasetryagainlater. Whydoesdrive.mount()sometimesfailsaying"timedout",andwhydoI/Ooperationsindrive.mount()-mountedfolderssometimesfail?GoogleDriveoperationscantimeoutwhenthenumberoffilesorsubfoldersinafoldergrowstoolarge.Ifthousandsofitemsaredirectlycontainedinthetop-level"MyDrive"folderthenmountingthedrivewilllikelytimeout.Repeatedattemptsmayeventuallysucceedasfailedattemptscachepartialstatelocallybeforetimingout.Ifyouencounterthisproblem,trymovingfilesandfoldersdirectlycontainedin"MyDrive"intosub-folders.Asimilarproblemcanoccurwhenreadingfromotherfoldersafterasuccessfuldrive.mount().AccessingitemsinanyfoldercontainingmanyitemscancauseerrorslikeOSError:[Errno5]Input/outputerror.Again,youcanfixthisproblembymovingdirectlycontaineditemsintosub-folders.Notethat"deleting"filesorsubfoldersbymovingthemtotheTrashmaynotbeenough;ifthatdoesn'tseemtohelp,makesuretoalsoEmptyyourTrash. WhydoDriveoperationssometimesfailduetoquota?GoogleDriveenforcesvariouslimits,includingper-userandper-fileoperationcountandbandwidthquotas.ExceedingtheselimitswilltriggerInput/outputerrorasabove,andshowanotificationintheColabUI.Atypicalcauseisaccessingapopularsharedfile,oraccessingtoomanydistinctfilestooquickly.Workaroundsinclude:Copythefileusingdrive.google.comanddon'tshareitwidelysothatotherusersdon'tuseupitslimits.AvoidmakingmanysmallI/Oreads,insteadoptingtocopydatafromDrivetotheColabVMinanarchiveformat(e.g..zipor.tar.gzfiles)andunarchivethedatalocallyontheVMinsteadofinthemountedDrivedirectory.Waitadayforquotalimitstoreset. WhydoDriveoperationssometimesfailduetostoragequota?GoogleDriveimposesalimitonhowmuchdatacanbestoredinitbyeachuser.IfDriveoperationsarefailingwithInput/outputerrorandanotificationsaysstoragequotahasbeenexceeded,deletesomefilesusingdrive.google.comandEmptyyourTrashtoreclaimthespace.ItmighttakealittlewhileforthereclaimedspacetobeavailableinColab.Ifyou'dliketopurchasemoreDrivespace,visitGoogleDrive.NotethatpurchasingmorespaceonDrivewillnotincreasetheamountofdiskavailableonColabVMs.SubscribingtoColabProwill. ResourceLimits Whyaren’tresourcesguaranteedinColab?Inordertobeabletooffercomputationalresourcesfreeofcharge,Colabneedstomaintaintheflexibilitytoadjustusagelimitsandhardwareavailabilityonthefly.ResourcesavailableinColabvaryovertimetoaccommodatefluctuationsindemand,aswellastoaccommodateoverallgrowthandotherfactors. SomeuserswanttobeabletodomoreinColabthantheresourcelimitsallow.ColabProandPro+providepriorityaccesstofasterGPUs,longerrunningnotebooksandmorememory.OurlongtermgoalistocontinueprovidingafreeofchargeversionofColab,whilealsogrowinginasustainablefashiontomeettheneedsofourusers. IfyouwouldliketohavecompletecontroloveryourresourcesinColab,checkoutColabGCPMarketplaceVMs.ColabGCPMarketplaceVMsallowyoutospecifytheexactruntimeresourcestouseandprovideyouwithapersistentenvironmentyoucanmanagetoyourlikingwhilestillusingtheColabUI.WhataretheusagelimitsofColab?Colabisabletoprovideresourcesfreeofchargeinpartbyhavingdynamicusagelimitsthatsometimesfluctuate,andbynotprovidingguaranteedorunlimitedresources.Thismeansthatoverallusagelimitsaswellasidletimeoutperiods,maximumVMlifetime,GPUtypesavailable,andotherfactorsvaryovertime.Colabdoesnotpublishtheselimits,inpartbecausetheycan(andsometimesdo)varyquickly.GPUsandTPUsaresometimesprioritizedforuserswhouseColabinteractivelyratherthanforlong-runningcomputations,orforuserswhohaverecentlyusedlessresourcesinColab.Asaresult,userswhouseColabforlong-runningcomputations,oruserswhohaverecentlyusedmoreresourcesinColab,aremorelikelytorunintousagelimitsandhavetheiraccesstoGPUsandTPUstemporarilyrestricted.UsersinterestedinhavinghigherandmorestableusagelimitsmaybeinterestedinColabProandPro+.UserswithhighcomputationalneedsmaybeinterestedinusingColab’sUIwitheitheralocalruntimerunningontheirownhardwareorColabGCPMarketplaceVMs. WhattypesofGPUsareavailableinColab?ThetypesofGPUsthatareavailableinColabvaryovertime.ThisisnecessaryforColabtobeabletoprovideaccesstotheseresourcesfreeofcharge.UserswhoareinterestedinmorereliableaccesstoColab’sfastestGPUsmaybeinterestedinColabProandPro+.IfyouwouldliketousespecifichardwareinColab,checkoutColabGCPMarketplaceVMs. NotethatusingColabforcryptocurrencyminingisdisallowedentirely,andmayresultinyouraccountbeingrestrictedforusewithColabaltogether. HowlongcannotebooksruninColab?Notebooksrunbyconnectingtovirtualmachinesthathavemaximumlifetimesthatcanbeasmuchas12hours.NotebookswillalsodisconnectfromVMswhenleftidlefortoolong.MaximumVMlifetimeandidletimeoutbehaviormayvaryovertime,orbasedonyourusage.ThisisnecessaryforColabtobeabletooffercomputationalresourcesfreeofcharge.UsersinterestedinlongerVMlifetimesandmorelenientidletimeoutbehaviorsthatdon’tvaryasmuchovertimemaybeinterestedinColabProandPro+. IfyouwouldliketomanagethelifetimeofyourColabVM,checkoutColabGCPMarketplaceVMswhichprovideyouwithapersistentenvironmentyoucanmanagetoyourliking. HowmuchmemoryisavailableinColab?TheamountofmemoryavailableinColabvirtualmachinesvariesovertime(butisstableforthelifetimeoftheVM).(AdjustingmemoryovertimeallowsustocontinuetoofferColabfreeofcharge.)YoumaysometimesbeautomaticallyassignedaVMwithextramemorywhenColabdetectsthatyouarelikelytoneedit.UsersinterestedinhavingmorememoryavailabletotheminColab,andmorereliably,maybeinterestedinColabProandPro+orColabGCPMarketplaceVMs. HowcanIgetthemostoutofColab?ResourcesinColabareprioritizedforuserswhohaverecentlyusedlessresources,inordertopreventthemonopolizationoflimitedresourcesbyasmallnumberofusers.TogetthemostoutofColab,considerclosingyourColabtabswhenyouaredonewithyourwork,andavoidoptingforaGPUwhenitisnotneededforyourwork.ThiswillmakeitlesslikelythatyouwillrunintousagelimitsinColab.UsersinterestedingoingbeyondtheresourcelimitsinthefreeofchargeversionofColabmaybeinterestedinColabProandPro+. IsawamessagesayingmyGPUisnotbeingutilized.WhatshouldIdo?Colaboffersoptionalacceleratedcomputeenvironments,includingGPUandTPU.ExecutingcodeinaGPUorTPUruntimedoesnotautomaticallymeanthattheGPUorTPUisbeingutilized.ToavoidhittingyourGPUusagelimits,werecommendswitchingtoastandardruntimeifyouarenotutilizingtheGPU.ChooseRuntime>ChangeRuntimeTypeandsetHardwareAcceleratortoNone.ForexamplesofhowtoutilizeGPUandTPUruntimesinColab,seetheTensorflowWithGPUandTPUsInColabexamplenotebooks. AdditionalQuestions Whatbrowsersaresupported?Colabworkswithmostmajorbrowsers,andismostthoroughlytestedwiththelatestversionsofChrome,FirefoxandSafari. Howisthisrelatedtocolaboratory.jupyter.org?In2014weworkedwiththeJupyterdevelopmentteamtoreleaseanearlyversionofthetool.SincethenColabhascontinuedtoevolve,guidedbyinternalusage. Whataboutotherprogramminglanguages?ColabfocusesonsupportingPythonanditsecosystemofthird-partytools.We'reawarethatusersareinterestedinsupportforotherJupyterkernels(egRorScala).Wewouldliketosupportthese,butdon'tyethaveanyETA. Ifoundabugorhaveaquestion,whodoIcontact?OpenanyColabnotebook.ThengototheHelpmenuandselect”Sendfeedback...”. Whyprompttoenablethird-partycookies?ColabusesHTMLiframesandserviceworkershostedonseparateoriginsinordertodisplayrichoutputssecurely.Browsersrequireenablingthird-partycookiestousetheserviceworkerswithiniframes.Analternativetoenablingthird-partycookiesforallsitesistoallowthefollowinghostnameinyourbrowsersettings:googleusercontent.com. HowdoIchangetheeditorfont?Colabusesagenericmonospacefontfortheeditor.Youcanconfigurewhatfontfamilyisusedformonospaceinmostmodernbrowsers.Here'safewcommonones:InFirefox,followthestepsprovidedintheFirefoxsupportdocumentstoconfigurethe"Monospace"font.InChrome,navigateto"chrome://settings/fonts"andmodifythesectionlabeled"Fixed-widthfont". DoesColabsupportPython2?Python2isnolongersupportedinColab.ForinformationonmigratingyourcodefromPython2toPython3,seePortingPython2CodetoPython3. WherecanIlearnmoreaboutColabProandPro+?ThereisanFAQforColabProandPro+onthesign-uppage. HowdoesbillingworkforColabProandColabPro+?InformationforColabProandPro+,includingpricingandhowupgradesarehandled,canbefoundattheColabProandPro+sign-uppage. HowdoIaccessColabwithaWorkspaceaccount?AccesstoColabforWorkspaceusersiscontrolledbytheWorkspaceon/offcontrolaccessibletoyourorganization'sadministrator.WorkspaceforEducationorganizationsarerequiredtoobtainparentalconsentforstudents'(undertheageof18)useofAdditionalServiceswiththeirGoogleWorkspaceforEducationaccount.Formoreinformation,pleasereadourHelpCenterarticle“CommunicatingwithParentsandGuardiansaboutGoogleWorkspaceforEducation”.NotethatGoogleaccountsforchildrenundertheageof13arenotsupported. Google AboutGoogle Privacy TermsChangelanguage:българскиবাংলাčeštinadanskDeutschΕλληνικάEnglishEnglish(UnitedKingdom)españolespañol(Latinoamérica)eestisuomifrançaisGaeilgeहिन्दीmagyarIndonesiaitaliano日本語한국어lietuviųlatviešuNederlandspolskiportuguês(Brasil)português(Portugal)românăрусскийslovenčinaslovenščinasvenskaไทยTürkçeукраїнськаTiếngViệt中文(中国)中文(台灣)
延伸文章資訊
- 1Google Colab免费GPU 超详细使用教程 - CSDN博客
1.4 Colab 提供哪些类型的GPU. 为了保证计算资源的自动分配,Colab 中的可用GPU 类型是动态变化的,通常包括Nvidia K80、T4、P4 和 ...
- 2Python深度學習1:Google Colab介紹 - 大大通
Google Colab是一個基於Jupyter Notebook 的免費CPU虛擬機,透過瀏覽器即可 ... 免費使用GPU或TPU:Colab中可選用的GPU通常包括Nvidia K80,T...
- 3Google Colab - Using Free GPU - Tutorialspoint
Google Colab - Using Free GPU · Enabling GPU. To enable GPU in your notebook, select the followin...
- 4第一次用Google Colab 就上手
既然有免費的GPU 可以使用,大家當然也會想知道到底被分配到了多少GPU 能夠使用,因此這邊提供兩個方法讓各位查看GPU 的相關訊息。 方法一:輸入 !nvidia- ...
- 5如何使用Google Colab 提供的免費GPU
今天我將介紹該如何使用Google 免費提供的GPU —— 使用Colab 這個線上平台!Colab 的使用方法與著名的Jupyter notebook 一樣,相信有用過Jupyter ...