Instructions to use hasan-toontech/codegen-phaser with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hasan-toontech/codegen-phaser with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hasan-toontech/codegen-phaser")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hasan-toontech/codegen-phaser") model = AutoModelForCausalLM.from_pretrained("hasan-toontech/codegen-phaser", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hasan-toontech/codegen-phaser with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hasan-toontech/codegen-phaser" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hasan-toontech/codegen-phaser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hasan-toontech/codegen-phaser
- SGLang
How to use hasan-toontech/codegen-phaser 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 "hasan-toontech/codegen-phaser" \ --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": "hasan-toontech/codegen-phaser", "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 "hasan-toontech/codegen-phaser" \ --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": "hasan-toontech/codegen-phaser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hasan-toontech/codegen-phaser with Docker Model Runner:
docker model run hf.co/hasan-toontech/codegen-phaser
| library_name: transformers | |
| tags: [] | |
| ### Model Description | |
| CodeGen-Mono 350M Fine-Tuned for Phaser.js | |
| This model is a fine-tuned version of the CodeGen-Mono 350M, specifically optimized for generating Phaser.js code based on user prompts. | |
| Phaser.js is a popular 2D game framework used for creating web-based games, and this model aims to assist developers by generating relevant | |
| game code snippets, enhancing productivity and creativity. | |
| - **Developed by:** Toontech Ltd. | |
| - **Funded by:** Toontech Ltd. | |
| - **Language(s) (NLP):** English | |
| - **Finetuned from model:** CodeGen (CodeGen-Mono 350M) | |
| **Model Overview** | |
| Base Model: CodeGen-Mono 350M | |
| Training Data: Fine-tuned on a custom dataset of Phaser.js code examples, covering various aspects like User Input Handling, | |
| Audio Management, Text Display, Tilemap Handling, Scene Management, Camera Controls, and Particles and Effects. | |
| **Purpose:** To generate Phaser.js code snippets based on natural language prompts, helping developers to quickly prototype and implement game | |
| features. | |
| **Key Features** | |
| User-Friendly: Accepts plain English prompts and translates them into functional Phaser.js code. | |
| Versatile: Capable of handling a variety of game development tasks, from simple input handling to complex scene management. | |
| Optimized for Game Development: Specifically fine-tuned on a wide range of Phaser.js use cases to provide accurate and efficient code | |
| generation. | |
| **Use Cases** | |
| Game Development Prototyping: Quickly generate code snippets to prototype game mechanics and features. | |
| Learning Tool: A valuable resource for beginners learning Phaser.js, providing examples and code structure. | |
| Coding Assistance: Acts as an intelligent code assistant for experienced developers, helping to reduce development time and improve | |
| workflow. | |
| **How to Use** | |
| You can use this model with the Hugging Face transformers library or integrate it into your custom applications using the provided API. | |
| Here’s a basic example: | |
| from transformers import pipeline | |
| codegen_pipeline = pipeline("text2text-generation", model="your-huggingface-username/CodeGen-Mono-350M-Phaser") | |
| prompt = "Create a Phaser.js code snippet to move a sprite with arrow keys." | |
| response = codegen_pipeline(prompt) | |
| print(response[0]['generated_text']) | |
| **Model Limitations** | |
| Phaser.js Specific: The model is specialized for Phaser.js and may not generalize well to other frameworks or coding languages. | |
| Code Quality: Generated code might require additional refinement and testing for edge cases. | |
| **Future Work** | |
| Planned improvements include expanding the training dataset, incorporating more advanced game development scenarios, and enhancing model | |
| accuracy and usability. | |
| **Feedback and Contributions** | |
| Your feedback is invaluable! If you encounter any issues or have suggestions, please feel free to open an issue or contribute directly to | |
| the repository. |