Google Colab

文章推薦指數: 80 %
投票人數:10人

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中文(中国)中文(台灣)



請為這篇文章評分?