Instructions to use SkillForge45/CyberFuture-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SkillForge45/CyberFuture-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SkillForge45/CyberFuture-2")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SkillForge45/CyberFuture-2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SkillForge45/CyberFuture-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SkillForge45/CyberFuture-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkillForge45/CyberFuture-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SkillForge45/CyberFuture-2
- SGLang
How to use SkillForge45/CyberFuture-2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SkillForge45/CyberFuture-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkillForge45/CyberFuture-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SkillForge45/CyberFuture-2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkillForge45/CyberFuture-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SkillForge45/CyberFuture-2 with Docker Model Runner:
docker model run hf.co/SkillForge45/CyberFuture-2
| from fastapi import FastAPI, HTTPException, UploadFile, File, Form | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from pydantic import BaseModel | |
| from model import SimpleTransformerModel, FullChatDataset, VoiceInterface, generate_response | |
| import torch | |
| import uvicorn | |
| import os | |
| from typing import Optional | |
| app = FastAPI() | |
| # CORS middleware | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Initialize components | |
| dataset = FullChatDataset() | |
| model = SimpleTransformerModel(len(dataset.tokenizer)) | |
| voice_interface = VoiceInterface() | |
| class ChatRequest(BaseModel): | |
| prompt: str | |
| max_length: int = 100 | |
| use_voice: bool = False | |
| async def chat_endpoint( | |
| prompt: Optional[str] = Form(None), | |
| max_length: int = Form(100), | |
| use_voice: bool = Form(False), | |
| audio_file: Optional[UploadFile] = File(None) | |
| ): | |
| try: | |
| # Handle voice input if audio file provided | |
| if audio_file: | |
| contents = await audio_file.read() | |
| with open("temp_audio.wav", "wb") as f: | |
| f.write(contents) | |
| with sr.AudioFile("temp_audio.wav") as source: | |
| audio = voice_interface.recognizer.record(source) | |
| prompt = voice_interface.recognizer.recognize_google(audio) | |
| os.remove("temp_audio.wav") | |
| # If no prompt provided (either text or voice) | |
| if not prompt: | |
| raise HTTPException(status_code=400, detail="No input provided") | |
| response = generate_response( | |
| model, | |
| dataset.tokenizer, | |
| prompt, | |
| max_length, | |
| voice_interface if use_voice else None | |
| ) | |
| return {"response": response} | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=str(e)) | |
| async def read_root(): | |
| return {"message": "CyberFuture Running"} | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=8000) |