📚
Docs - Float16
homeapp
  • 🚀GETTING STARTED
    • Introduction
    • Account
      • Dashboard
      • Profile
      • Payment
      • Workspace
      • Service Quota
    • LLM as a service
      • Quick Start
        • Set the credentials
      • Supported Model
      • Limitation
      • API Reference
    • One Click Deploy
      • Quick Start
        • Instance Detail
        • Re-generate API Key
        • Terminate Instance
      • Features
        • OpenAI Compatible
        • Long context and Auto scheduler
        • Quantization
        • Context caching
      • Limitation
      • Validated model
      • Endpoint Specification
    • Serverless GPU
      • Quick Start
        • Mode
        • Task Status
        • App Features
          • Project Detail
      • Tutorials
        • Hello World
        • Install new library
        • Prepare model weight
        • S3 Copy output from remote
        • R2 Copy output from remote
        • Direct upload and download
        • Server mode
        • LLM Dynamic Batching
        • Train and Inference MNIST
        • Etc.
      • CLI References
      • ❓FAQ
    • Playground
      • FloatChat
      • FloatPrompt
      • Quantize by Float16
  • 📚Use Case
    • Q&A Bot (RAG)
    • Text-to-SQL
    • OpenAI with Rate Limit
    • OpenAI with Guardrail
    • Multiple Agents
    • Q&A Chatbots (RAG + Agents)
  • ✳️Journey
    • ✨The Beginner's LLM Development Journey
    • 📖Glossary
      • [English Version] LLM Glossary
      • [ภาษาไทย] LLM Glossary
    • 🧠How to install node
  • Prompting
    • 📚Variable
    • ⛓️Condition
    • 🔨Demonstration
    • ⌛Loop
    • 📙Formatting
    • 🐣Chat
    • 🔎Technical term (Retrieve)
  • Privacy Policy
  • Terms & Conditions
Powered by GitBook
On this page
  • Step 1 : Create requirements.txt
  • Step 2 : Start the Project
  • Step 3 : Update Libraries (if needed)
  • Step 4 : Run Your Script
  • Explore More
  1. GETTING STARTED
  2. Serverless GPU
  3. Tutorials

Install new library

Installing New Libraries in Your Float16 Remote Instance

PreviousHello WorldNextPrepare model weight

Last updated 1 month ago

This tutorial will guide you through adding new libraries to your Float16 remote instance. Since the remote instance starts as an empty container, you need to install libraries before running your code.

  • Float16 CLI installed and logged in

  • If not logged in, refer to the

This example scenario, we'll use a script 'cat.py' that imports the 'requests' library to fetch data from a cat fact API.

import requests

cat_fact = requests.get('https://catfact.ninja/fact')
if cat_fact.status_code == 200:
    print("\nFun fact about cats:")
    print(cat_fact.json()['fact'])

While you can simply use pip install requests on your local machine, the process is different for the remote instance.

Step 1 : Create requirements.txt

Create a requirements.txt file to specify dependencies.

float16 init

This command creates both 'float16.conf' and 'requirements.txt' files.

Open 'requirements.txt' and add the following

requests==2.31.0

This specifies the library name and the version you want to install.

Step 2 : Start the Project

Start the container, which automatically installs packages listed in 'requirements.txt'

float16 project start

Step 3 : Update Libraries (if needed)

After starting the project and successfully installing packages, you might find that the installed version doesn't match your local version. This could potentially affect your code. Here's how to update

Check the current version: pip show <PACKAGE> | grep Version or pip list

To upgrade the version (e.g., from '2.31.0' to '2.32.3'), edit 'requirements.txt'

requests==2.32.3

Update package dependencies

float16 project install

Step 4 : Run Your Script

Execute your script

float16 run cat.py

Example output (The response is randomly generated, so you may see a different cat fact.):

Fun fact about cats:
The average lifespan of an outdoor-only cat is about 3 to 5 years while an indoor-only cat can live 16 years or much longer.

Congratulations! You've become proficient in installing new libraries in your Float16 remote instance.

Explore More

Learn how to use Float16 CLI for various use cases in our tutorials.

Happy coding with Float16 Serverless GPU!

🚀
Hello World tutorial

Hello World

Launch your first serverless GPU function and kickstart your journey.

Install new library

Enhance your toolkit by adding new libraries tailored to your project needs.

Copy output from remote

Efficiently transfer computation results from remote to your local storage.

Deploy FastAPI Helloworld

Quick start to deploy FastAPI without change the code.

Upload and Download via CLI and Website

Direct upload and download file(s) to server.

More examples

Open source from community and Float16 team.